selenium.common.exceptions.WebDriverException:消息:“色驱动程序”可执行文件需要在无头Chrome的路径错误中当我运行我的脚本时,我得到了这个错误Traceback (most recent call last):
File "C:\Users\ishaq\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\common\service.py", line 74,
in start
stdout=self.log_file, stderr=self.log_file)
File "C:\Users\ishaq\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 707, in __init__
restore_signals, start_new_session)
File "C:\Users\ishaq\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 992, in _execute_child
startupinfo)FileNotFoundError: [WinError 2] The system cannot find the file specifiedDuring handling of the
above exception,
another exception occurred:Traceback (most recent call last):这是我的剧本import os from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.chrome.options import Options chrome_options = Options() chrome_options.add_argument("--headless") chrome_options.binary_location = r'C:\Users\ishaq\Desktop\chrome\chromedriver.exe' driver = webdriver.Chrome(executable_path=os.path.abspath("chromedriver"), chrome_options=chrome_options) driver.get("http://www.duo.com") magnifying_glass = driver.find_element_by_id("js-open-icon") if magnifying_glass.is_displayed(): magnifying_glass.click() else: menu_button = driver.find_element_by_css_selector(".menu-trigger.local") menu_button.click() search_field = driver.find_element_by_id("site-search") search_field.clear() search_field.send_keys("Olabode") search_field.send_keys(Keys.RETURN) assert "Looking Back at Android Security in 2016" in driver.page_sourcedriver.close()
添加回答
举报
0/150
提交
取消