You need to create the command line file for Opera for Android and enable remote debugging:
adb shell "echo 'opera --enable-remote-debugging' &> /data/local/tmp/opera-browser-command-line"
# Create OperaDriver service:
from selenium.webdriver.chrome import service
webdriver_service = service.Service('path/to/operadriver')
# Create remote webdriver:
from selenium import webdriver
remote = webdriver.Remote(webdriver_service, capabilities)
Depending on capabilites OperaDriver may be connected to the browser in two ways.
- Let OperaDriver start Opera.
capabilities = {
'operaOptions': {
'androidPackage': 'com.opera.browser'
}
}
- Attach to the existing Opera instance.
capabilities = {
'operaOptions': {
'androidPackage': 'com.opera.browser',
'androidUseRunningPackage': true
}
}
The list of operaOptions
for Android is similar to the available desktop options.