File tree 4 files changed +43
-3
lines changed
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
5
5
## Creating an OperaDriver service
6
6
7
7
``` python
8
- # Create OperaDriver service:
8
+ # Create and start OperaDriver service:
9
9
from selenium.webdriver.chrome import service
10
10
webdriver_service = service.Service(opera_driver_exe_path,
11
11
port_on_which_service_will_be_running)
12
+ webdriver_service.start()
12
13
```
14
+ ### Creating a remote webdriver for selenium 4
13
15
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
15
30
16
31
``` python
17
32
# Create remote webdriver:
Original file line number Diff line number Diff line change 36
36
## Run example
37
37
38
38
For 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 ) .
40
43
41
44
## Troubleshooting
42
45
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