Macbook上chromedrive的路径?

我正在尝试设置硒,但是遇到错误“标识符中的无效字符”

这是我的代码:

from selenium import webdriver 
from selenium.webdriver.common.by import By 
from selenium.webdriver.support.ui import WebDriverWait 
from selenium.webdriver.support import expected_conditions as EC 
from selenium.common.exceptions import TimeoutException

option = webdriver.ChromeOptions()

browser = webdriver.Chrome(executable_path = ‎'Macintosh HD/Users/username/Downloads/chromedriver',chrome_options=option)

无效字符在哪里?我尝试了多种变体,但仍然收到相同的错误

xingyuechen 回答:Macbook上chromedrive的路径?

删除BaseContext

Macintosh HD
,

在Mac OS上要获取chromedriver的路径时,请将其拖放到Terminal。因此,它将为您提供该文件的路径。 在这种情况下,不需要“ Macintosh HD”。 您可以直接使用“ /用户/用户名/下载/ chromedriver”。

本文链接:https://www.f2er.com/3169182.html

大家都在问