File tree Expand file tree Collapse file tree 4 files changed +43
-3
lines changed Expand file tree Collapse file tree 4 files changed +43
-3
lines changed Original file line number Diff line number Diff line change @@ -5,13 +5,28 @@ For now to drive the Chromium-based Opera you’ll need to use the `RemoteWebDri
55## Creating an OperaDriver service
66
77``` python
8- # Create OperaDriver service:
8+ # Create and start OperaDriver service:
99from selenium.webdriver.chrome import service
1010webdriver_service = service.Service(opera_driver_exe_path,
1111 port_on_which_service_will_be_running)
12+ webdriver_service.start()
1213```
14+ ### Creating a remote webdriver for selenium 4
1315
14- ### Creating a remote webdriver
16+ ``` python
17+ # Create OperaDriver options:
18+ from selenium import webdriver
19+ options = webdriver.ChromeOptions()
20+ options.binary_location = opera_exe_path
21+ options.add_experimental_option(' w3c' , True )
22+ ```
23+
24+ ``` python
25+ # Create remote webdriver
26+ remote = webdriver.Remote(webdriver_service.service_url, options = options)
27+ ```
28+
29+ ### Creating a remote webdriver for selenium 2, 3
1530
1631``` python
1732# Create remote webdriver:
Original file line number Diff line number Diff line change 3636## Run example
3737
3838For Android use [ pure Selenium] ( ../examples/android.py ) or [ Appium] ( ../examples/appium_simple.py ) .
39- Desktop example: [ desktop.py] ( ../examples/desktop.py ) .
39+
40+ Desktop example for selenium 2 and selenium 3: [ desktop_selenium_2.x_and_3.x.py] ( ../examples/desktop_selenium_2.x_and_3.x.py ) .
41+
42+ Desktop example for selenium 4: [ desktop_selenium_4.x.py] ( ../examples/desktop_selenium_4.x.py ) .
4043
4144## Troubleshooting
4245
File renamed without changes.
Original file line number Diff line number Diff line change 1+ import time
2+
3+ from selenium import webdriver
4+ from selenium .webdriver .chrome import service
5+
6+ from selenium .webdriver .common .by import By
7+
8+ webdriver_service = service .Service ("path/to/operadriver" )
9+ webdriver_service .start ()
10+
11+ options = webdriver .ChromeOptions ()
12+ options .binary_location = "path/to/operabrowser"
13+ options .add_experimental_option ('w3c' , True )
14+
15+ driver = webdriver .Remote (webdriver_service .service_url , options = options )
16+
17+ driver .get ('https://www.google.com/' )
18+ input_txt = driver .find_element (By .NAME , 'q' )
19+ input_txt .send_keys ('operadriver\n ' )
20+
21+ time .sleep (5 ) # see the result
22+ driver .quit ()
You can’t perform that action at this time.
0 commit comments