OperaChromiumDriver installation using OperaDriverManager for Ubuntu 18.04

732 views Asked by At

I am simply trying to get a webscraper working in a Civis container script ( Linux (Ubuntu 18.04) environment). I've tried a variety of things but this is the closest I've got and have no clue how to resolve this error. It occurs regarless of what browser I use from the webdriver-manager package.

Requirements are:

pip install ruamel.yaml
pip install selenium==3.14.0
pip install webdriver-manager

Script is:

from selenium import webdriver
from webdriver_manager.opera import OperaDriverManager

driver = webdriver.Opera(executable_path=OperaDriverManager().install())
driver.get("https://www.google.com")

print("great sucess")

driver.close()

Output is :

04/12/2022 5:00:56 PM
====== WebDriver manager ======
04/12/2022 5:00:56 PM
There is no [linux64] operadriver for browser  in cache
04/12/2022 5:00:56 PM
Getting latest opera release info for v.99.0.4844.51
04/12/2022 5:00:56 PM
Trying to download new driver from https://github.com/operasoftware/operachromiumdriver/releases/download/v.99.0.4844.51/operadriver_linux64.zip
04/12/2022 5:00:57 PM
Driver has been saved in cache [/root/.wdm/drivers/operadriver/linux64/v.99.0.4844.51]
04/12/2022 5:00:58 PM
Traceback (most recent call last):
04/12/2022 5:00:58 PM
  File "index.py", line 4, in <module>
04/12/2022 5:00:58 PM
    driver = webdriver.Opera(executable_path=OperaDriverManager().install())
04/12/2022 5:00:58 PM
  File "/opt/conda/lib/python3.7/site-packages/selenium/webdriver/opera/webdriver.py", line 78, in __init__
04/12/2022 5:00:58 PM
    service_log_path=service_log_path)
04/12/2022 5:00:58 PM
  File "/opt/conda/lib/python3.7/site-packages/selenium/webdriver/opera/webdriver.py", line 57, in __init__
04/12/2022 5:00:58 PM
    service_log_path=service_log_path)
04/12/2022 5:00:58 PM
  File "/opt/conda/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 68, in __init__
04/12/2022 5:00:58 PM
    self.service.start()
04/12/2022 5:00:58 PM
  File "/opt/conda/lib/python3.7/site-packages/selenium/webdriver/common/service.py", line 98, in start
04/12/2022 5:00:58 PM
    self.assert_process_still_running()
04/12/2022 5:00:58 PM
  File "/opt/conda/lib/python3.7/site-packages/selenium/webdriver/common/service.py", line 111, in assert_process_still_running
04/12/2022 5:00:58 PM
    % (self.path, return_code)
04/12/2022 5:00:58 PM
selenium.common.exceptions.WebDriverException: Message: Service /root/.wdm/drivers/operadriver/linux64/v.99.0.4844.51/operadriver_linux64/operadriver unexpectedly exited. Status code was: 127
04/12/2022 5:00:58 PM
Failed: The job container failed. Exit code 1

If there is anything I should try to add / differen't approaches, please feel free to let me know.

1

There are 1 answers

0
undetected Selenium On

OperaDriverManager is downloading operachromiumdriver`v99.0.4844.51_ which was released recently.

Where as you are using selenium==3.14.0 which almost 4 years old and ancient now.


Solution

Ensure that:

compatible code block:

from selenium import webdriver
from webdriver_manager.opera import OperaDriverManager
from selenium.webdriver.chrome.service import Service

driver = webdriver.Chrome(service=Service(OperaDriverManager().install())
driver.get("https://www.google.com")
print("great sucess")