Skip to content

Commit 7c171b3

Browse files
committed
Update examples
1 parent e414b64 commit 7c171b3

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

examples/raw_google.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
with SB(uc=True, test=True) as sb:
44
url = "https://google.com/ncr"
55
sb.activate_cdp_mode(url)
6-
sb.type('[title="Search"]', "SeleniumBase GitHub page")
7-
sb.click("div:not([jsname]) > * > input")
8-
sb.sleep(2)
6+
sb.type('[name="q"]', "SeleniumBase GitHub page")
7+
sb.click('[value="Google Search"]')
8+
sb.sleep(4) # The "AI Overview" sometimes loads
99
print(sb.get_page_title())
10-
sb.sleep(1) # Wait for the "AI Overview" result
11-
if sb.is_text_visible("Generating"):
12-
sb.wait_for_text("AI Overview")
13-
sb.save_as_pdf_to_logs() # Saved to ./latest_logs/
10+
sb.save_as_pdf_to_logs()
1411
sb.save_page_source_to_logs()
1512
sb.save_screenshot_to_logs()
13+
print("Logs have been saved to: ./latest_logs/")

examples/raw_test_scripts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
with SB(uc=True, test=True) as sb:
55
sb.open("https://google.com/ncr")
66
sb.type('[name="q"]', "SeleniumBase on GitHub")
7-
sb.click("div:not([jsname]) > * > input")
7+
sb.click('[value="Google Search"]')
88
sb.highlight('a[href*="github.com/seleniumbase"]')
99
sb.sleep(0.5)
1010

seleniumbase/plugins/sb_manager.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
with SB(uc=True, test=True) as sb:
1414
url = "https://google.com/ncr"
1515
sb.activate_cdp_mode(url)
16-
sb.type('[title="Search"]', "SeleniumBase GitHub page")
17-
sb.click("div:not([jsname]) > * > input")
16+
sb.type('[name="q"]', "SeleniumBase GitHub page")
17+
sb.click('[value="Google Search"]')
1818
sb.sleep(2)
1919
print(sb.get_page_title())
2020
```
@@ -148,8 +148,8 @@ def SB(
148148
with SB(uc=True, test=True) as sb:
149149
url = "https://google.com/ncr"
150150
sb.activate_cdp_mode(url)
151-
sb.type('[title="Search"]', "SeleniumBase GitHub page")
152-
sb.click("div:not([jsname]) > * > input")
151+
sb.type('[name="q"]', "SeleniumBase GitHub page")
152+
sb.click('[value="Google Search"]')
153153
sb.sleep(2)
154154
print(sb.get_page_title())
155155

0 commit comments

Comments
 (0)