Update examples

This commit is contained in:
Michael Mintz 2025-02-21 22:18:35 -05:00
parent ab48a87893
commit 1f581ed757
5 changed files with 8 additions and 5 deletions

View File

@ -1,7 +1,7 @@
"""Context Manager Test. Runs with "python". (pytest not needed)"""
from seleniumbase import SB
with SB(test=True) as sb:
with SB(test=True, uc=True) as sb:
sb.open("https://google.com/ncr")
sb.type('[name="q"]', "SeleniumBase on GitHub\n")
sb.click('a[href*="github.com/seleniumbase"]')

View File

@ -855,7 +855,7 @@ Here's another example, which uses <code translate="no">test</code> mode:
```python
from seleniumbase import SB
with SB(test=True) as sb:
with SB(test=True, uc=True) as sb:
sb.open("https://google.com/ncr")
sb.type('[name="q"]', "SeleniumBase on GitHub\n")
sb.click('a[href*="github.com/seleniumbase"]')

View File

@ -631,10 +631,13 @@ def main():
data = []
data.append("from seleniumbase import BaseCase")
data.append("from .google_objects import HomePage, ResultsPage")
data.append('BaseCase.main(__name__, __file__, "--uc")')
data.append("")
data.append("")
data.append("class GoogleTests(BaseCase):")
data.append(" def test_google_dot_com(self):")
data.append(" if not self.undetectable:")
data.append(" self.get_new_driver(undetectable=True)")
data.append(' self.open("https://google.com/ncr")')
data.append(' self.assert_title_contains("Google")')
data.append(" self.sleep(0.05)")

View File

@ -10,7 +10,7 @@ Example -->
```python
from seleniumbase import DriverContext
with DriverContext() as driver:
with DriverContext(uc=True) as driver:
driver.get("https://google.com/ncr")
```
@ -30,7 +30,7 @@ Example -->
```python
from seleniumbase import Driver
driver = Driver()
driver = Driver(uc=True)
driver.get("https://google.com/ncr")
```

View File

@ -10,7 +10,7 @@ Example -->
```python
from seleniumbase import SB
with SB() as sb: # Many args! Eg. SB(browser="edge")
with SB(uc=True) as sb: # Many args! Eg. SB(browser="edge")
sb.open("https://google.com/ncr")
sb.type('[name="q"]', "SeleniumBase on GitHub\n")
sb.click('a[href*="github.com/seleniumbase"]')