Selenium Macbook上chromedrive的路径?
我正在尝试设置selenium,但遇到错误“标识符中的字符无效” 这是我的代码:Selenium Macbook上chromedrive的路径?,selenium,selenium-webdriver,Selenium,Selenium Webdriver,我正在尝试设置selenium,但遇到错误“标识符中的字符无效” 这是我的代码: 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 sele
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)
无效字符在哪里?我尝试了多种变体,但仍然出现相同的错误删除
Macintosh HD
:
option = webdriver.ChromeOptions()
browser = webdriver.Chrome(executable_path='/Users/username/Downloads/chromedriver', chrome_options=option)
当您想在Mac OS上获取chromedriver的路径时,将该文件拖放到终端。因此,它将为您提供该文件的路径。 在这种情况下,不需要“Macintosh HD”。 您可以直接使用“/Users/username/Downloads/chromedriver”。解决您的问题了吗?