Skip to content

Commit eea2441

Browse files
committed
Update the documentation
1 parent d109ec4 commit eea2441

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

help_docs/syntax_formats.md

+37-1
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,43 @@ finally:
935935

936936
(From <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_browser_launcher.py">examples/raw_browser_launcher.py</a>)
937937

938-
The above format can be used as a drop-in replacement for virtually every Python/selenium framework, as it uses the raw ``driver`` instance for handling commands. The ``Driver()`` method simplifies the work of managing drivers with optimal settings, and it can be configured via multiple method args. The Driver also accepts command-line options (such as ``python --headless``) so that you don't need to modify your tests directly to use different settings. These command-line options only take effect if the associated method args remain unset (or set to ``None``) for the specified options.
938+
Here's how the [selenium-wire](https://github.com/wkeeling/selenium-wire) integration may look when using the ``Driver()`` format:
939+
940+
```python
941+
from seleniumbase import Driver
942+
943+
driver = Driver(wire=True, headless=True)
944+
try:
945+
driver.get("https://wikipedia.org")
946+
for request in driver.requests:
947+
print(request.url)
948+
finally:
949+
driver.quit()
950+
```
951+
952+
Here's an example of basic login with the ``Driver()`` format:
953+
954+
```python
955+
from seleniumbase import Driver
956+
957+
driver = Driver()
958+
try:
959+
driver.open("seleniumbase.io/simple/login")
960+
driver.type("#username", "demo_user")
961+
driver.type("#password", "secret_pass")
962+
driver.click('a:contains("Sign in")')
963+
driver.assert_exact_text("Welcome!", "h1")
964+
driver.assert_element("img#image1")
965+
driver.highlight("#image1")
966+
driver.click_link("Sign out")
967+
driver.assert_text("signed out", "#top_message")
968+
finally:
969+
driver.quit()
970+
```
971+
972+
(From <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_login_driver.py">examples/raw_login_driver.py</a>)
973+
974+
The ``Driver()`` manager format can be used as a drop-in replacement for virtually every Python/selenium framework, as it uses the raw ``driver`` instance for handling commands. The ``Driver()`` method simplifies the work of managing drivers with optimal settings, and it can be configured with multiple args. The ``Driver()`` also accepts command-line options (such as ``python --headless``) so that you don't need to modify your tests directly to use different settings. These command-line options only take effect if the associated method args remain unset (or set to ``None``) for the specified options.
939975

940976
--------
941977

0 commit comments

Comments
 (0)