I am trying to launch opera using python selenium libraries. But getting capabilities error.
Codes I have tried:
Code1:
driver = webdriver.Opera()
driver.get('https://www.google.com')
Code2:
driver = webdriver.Opera(r'path to operadriver.exe')
driver.get('https://www.google.com')
Code3:
options = Options()
options.binary_location = r'C:\Opera\launcher.exe'
driver = webdriver.Opera(options=options)
driver.get('https://www.google.com')
Output:
Code1:
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Opera binary
Code2:
selenium.common.exceptions.WebDriverException: Message: Desired Capabilities must be a dictionary
Code3:
[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)
Only with code 3 the Opera browser launchers. But URL doesn't opens.
As I am able to launch chrome with similar codes.
This worked for me:
I also get the same errors you showed but the URLs I need to open are being loaded automatically in Opera without issue.
You need to make sure your opera version matches the version of the driver. check it by opening opera and enter this: opera://about Ensure the operadriver.exe is on the same folder of the python script.
The driver can be downloaded here: https://github.com/operasoftware/operachromiumdriver/releases