我正在尝试使用 python selenium 库启动歌剧。但获取功能错误。
我尝试过的代码:
代码1:
driver = webdriver.Opera()
driver.get('https://www.google.com')
代码2:
driver = webdriver.Opera(r'path to operadriver.exe')
driver.get('https://www.google.com')
代码3:
options = Options()
options.binary_location = r'C:\Opera\launcher.exe'
driver = webdriver.Opera(options=options)
driver.get('https://www.google.com')
输出:
代码1:
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Opera binary
代码2:
selenium.common.exceptions.WebDriverException: Message: Desired Capabilities must be a dictionary
代码3:
[20904:3220:0120/034255.122:ERROR:os_crypt_win.cc(61)] Failed to decrypt: The parameter is incorrect. (0x57)
DevTools listening on ws://127.0.0.1:59016/devtools/browser/0bb7bc3c-4b9a-451a-a736-a02a63feba7a
[20904:3220:0120/034255.673:ERROR:CONSOLE(0)] "Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.", source: chrome://startpage/ (0)
[20904:3220:0120/034255.674:ERROR:CONSOLE(0)] "Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.", source: chrome://startpage/ (0)
[20904:3220:0120/034255.675:ERROR:CONSOLE(0)] "Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.", source: chrome://startpage/ (0)
只有代码 3 的 Opera 浏览器启动器。但是网址打不开。
因为我能够使用类似的代码启动 chrome。