I'm using the latest version of Opera - version 95.0.4635.46 (x86_64), which is based on Chromium version:109.0.5414.120 and chrome driver version 109.0.5414.74.
When I run the following code on macOS:
import time
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
opera_options = webdriver.ChromeOptions()
opera_options.binary_location = "/Applications/Opera.app/Contents/MacOS/Opera"
opera_options.add_argument("start-maximized")
opera_options.add_argument("--disable-extensions")
opera_options.add_argument("--disable-gpu")
opera_options.add_argument("--disable-dev-shm-usage")
opera_options.add_argument("--no-sandbox")
service = Service(executable_path='./chromedriver')
opera_driver = webdriver.Chrome(service=service, options=opera_options)
time.sleep(3)
# opera_driver.execute_script("window.location.href = 'https://www.google.com'")
opera_driver.get("https://www.google.com")
time.sleep(10)
opera_driver.quit()
It just opens Opera browser without visiting the provided link for google. What's the reason for that? I've tried everything found on the web including adding intentional sleep and trying opera_driver.execute_script
but every time the browser starts with the following text in url bar: data:,
Update
I tried to use opera-drvier latest release (https://github.com/operasoftware/operachromiumdriver/releases) which is supposed to fix this issue (as its based on chrome driver and made specifically for opera-specific functionality), but when I run my code I get:
AttributeError: 'Service' object has no attribute 'process'
This error message...
...implies that executable_path has been deprecated instead you have to pass in a Service object as follows: