我只是试图让一个简单的Python脚本工作,这应该只打开谷歌。
我安装了硒具有画中画和放置operadriver,从硒页面下载到我的Python路径。 还看了很多关于它的视频,但我不能找到一个解决办法..
下面的代码:
from selenium import webdriver
import time
driver = webdriver.Opera()
driver.get('http://www.google.com')
错误:
Traceback (most recent call last):
File "C:/Users/Tom/AppData/Local/Programs/Python/Python37-32/Scripts/automate.py", line 4, in <module>
driver = webdriver.Opera()
File "C:\Users\Tom\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\opera\webdriver.py", line 83, in __init__
service_log_path=service_log_path)
File "C:\Users\Tom\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\opera\webdriver.py", line 62, in __init__
keep_alive=keep_alive)
File "C:\Users\Tom\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__
desired_capabilities=desired_capabilities)
File "C:\Users\Tom\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Users\Tom\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\Tom\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Tom\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Opera binary
(Driver info: OperaDriver=2.40 (a50783a565882ef2022bea655e8560f37ecf8afe),platform=Windows NT 6.1.7601 SP1 x86_64)