Skip to content

Commit 17dd2c5

Browse files
committed
Update docs for SB() / Driver() / DriverContext()
1 parent c3947b3 commit 17dd2c5

File tree

2 files changed

+36
-19
lines changed

2 files changed

+36
-19
lines changed

seleniumbase/plugins/driver_manager.py

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@
44
55
The SeleniumBase Driver as a context manager:
66
Usage --> ``with DriverContext() as driver:``
7-
Usage example -->
8-
from seleniumbase import DriverContext
9-
with DriverContext() as driver:
10-
driver.get("https://google.com/ncr")
11-
# The browser exits automatically after the "with" block ends.
7+
8+
Example -->
9+
10+
```
11+
from seleniumbase import DriverContext
12+
13+
with DriverContext() as driver:
14+
driver.get("https://google.com/ncr")
15+
```
16+
17+
# (The browser exits automatically after the "with" block ends.)
1218
1319
###########################################################################
1420
# Above: The driver as a context manager. (Used with a "with" statement.) #
@@ -18,10 +24,15 @@
1824
1925
The SeleniumBase Driver as a returnable object:
2026
Usage --> ``driver = Driver()``
21-
Usage example -->
22-
from seleniumbase import Driver
23-
driver = Driver()
24-
driver.get("https://google.com/ncr")
27+
28+
Example -->
29+
30+
```
31+
from seleniumbase import Driver
32+
33+
driver = Driver()
34+
driver.get("https://google.com/ncr")
35+
```
2536
2637
###########################################################################
2738
"""

seleniumbase/plugins/sb_manager.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,22 @@
44
55
The SeleniumBase SB Context Manager:
66
Usage --> ``with SB() as sb:``
7-
Usage example -->
8-
from seleniumbase import SB
9-
with SB() as sb: # Many args! Eg. SB(browser="edge")
10-
sb.open("https://google.com/ncr")
11-
sb.type('[name="q"]', "SeleniumBase on GitHub\n")
12-
sb.click('a[href*="github.com/seleniumbase"]')
13-
sb.highlight("div.Layout-main")
14-
sb.highlight("div.Layout-sidebar")
15-
sb.sleep(0.5)
16-
# The browser exits automatically after the "with" block ends.
7+
8+
Example -->
9+
10+
```
11+
from seleniumbase import SB
12+
13+
with SB() as sb: # Many args! Eg. SB(browser="edge")
14+
sb.open("https://google.com/ncr")
15+
sb.type('[name="q"]', "SeleniumBase on GitHub\n")
16+
sb.click('a[href*="github.com/seleniumbase"]')
17+
sb.highlight("div.Layout-main")
18+
sb.highlight("div.Layout-sidebar")
19+
sb.sleep(0.5)
20+
```
21+
22+
# (The browser exits automatically after the "with" block ends.)
1723
1824
#########################################
1925
"""

0 commit comments

Comments
 (0)