I am very new to Selenium, so I hope my question isn't stupid. I try to use selenium on Opera with Python. But everytime I try to run the code I got this error :
"selenium.common.exceptions.WebDriverException: Message: unknown error: cannot connect to Opera at localhost:1212
from session not created: Opera needs to be based on Chromium version between 70 and 73
(Driver info: OperaDriver=2.45.3255 (O60),platform=Linux 4.15.0-29-generic x86_64)"
I know that the last Opera version only use the 60 Chromium version. So its seems for me impossible to use Opera with Selenium.
But I saw many people use it anyways... So I must doing something wrong...
from selenium import webdriver
from selenium.webdriver.chrome import service
from bs4 import BeautifulSoup
webdriver_service = service.Service('operadriver_linux64/operadriver')
webdriver_service.start()
capabilities = { 'operaOptions': { 'debuggerAddress': "localhost:1212" }}
driver = webdriver.Remote(webdriver_service.service_url, capabilities)
driver.get('https://www.google.com/')
input_txt = driver.find_element_by_name('q')
input_txt.send_keys('operadriver\n')
soup = BeautifulSoup(driver.page_source, 'html.parser')
print(soup.title.string)
print("---")
for site in soup.find_all('h3'):
for child in site.children:
print(child.string)
print(child['href'])
driver.quit()
So here is what I got :
File "test.py", line 14, in <module>
driver = webdriver.Remote(webdriver_service.service_url, capabilities) File "/home/ender/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile) File "/home/ender/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters) File "/home/ender/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response) File "/home/ender/.local/lib/python3.6/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 connect to Opera at localhost:1212
from session not created: Opera needs to be based on Chromium version between 70 and 73
(Driver info: OperaDriver=2.45.3255 (O60),platform=Linux 4.15.0-29-generic x86_64)
You are incorrect about Opera only using up to Chromium 60. On Wikipedia it mentions that the latest Opera versions do use Chromium 70 to 73.
Opera 57 was released on November 28, 2018, based on Chromium 70.
Opera 58 was released on January 23, 2019, based on Chromium 71.
Opera 60 was released on April 9, 2019, based on Chromium 73.
Opera 62 was released on June 27, 2019, based on Chromium 75.
https://en.wikipedia.org/wiki/History_of_the_Opera_web_browser#Opera_2018
You just have to use Opera 57 to 60.
Here is a link to Opera 60 on FileHippo: https://filehippo.com/download_opera/91340/