我有Selenium的問題! 我試過3.6和2.7,但沒有區別! 我使用WIN7(64位)硒不能在Python中工作
讓我們先從簡單的代碼:
binary = FirefoxBinary(r"C:\Program Files\Mozilla Firefox\firefox.exe")
fp = webdriver.FirefoxProfile()
driver = webdriver.Firefox(firefox_binary=binary, firefox_profile=fp)
所以,我得到這些錯誤:
C:\ Python27 \ python.exeË :/Python/MathBattle_Solver/test.py
回溯(最近通話最後一個): 文件 「E:/Python/MathBattle_Solver/test.py」,13號線,在 下載(」 https://www.google.com「)
文件 「E:/Python/MathBattle_Solver/test.py」,9號線,在下載 瀏覽器= webdriver.Firefox(能力= firefox_capabilities,executable_path = R'C:\ WINDOWS \ SYSTEM32 \ geckodriver。 exe文件')
文件 「C:\ Python27 \ lib中\站點包\硒\的webdriver \火狐\ webdriver.py」,線144,在初始化 self.service.start()
文件「C:\ Python27 \ lib \ site-packages \ selenium \ webdriver \ common \ service.py」,第81行,開頭 os.path.basename(self.path),self.start_error_message)
selenium.common.exceptions.WebDriverException:消息:'geckodriver.exe'可執行文件需要位於PATH中。
我下載了「geckodriver.exe」,把它放到system32文件夾中,並從環境變量中加入到PATH系統變量中,但什麼都沒發生!還是一樣的錯誤!
有什麼想法?
版本? –
@KishanPatel 52.0.2(64bit) –
它不起作用。使用版本47或更低版本。在github https://github.com/SeleniumHQ/selenium/issues/3658 –