Skip to content

Commit f793be5

Browse files
committed
Update examples
1 parent c5db2c1 commit f793be5

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

examples/proxy_test.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,30 @@ def test_proxy(self):
1313
if not self.page_load_strategy == "none" and not self.undetectable:
1414
# This page takes too long to load otherwise
1515
self.get_new_driver(page_load_strategy="none")
16+
self.open("https://api.ipify.org/")
17+
ip_address = self.get_text("body")
1618
self.open("https://ipinfo.io/")
17-
self.wait_for_non_empty_text("form input", timeout=20)
18-
ip_address = self.get_text('#ip-string span[class*="primary"] span')
19+
self.type('input[name="search"]', ip_address, timeout=20)
20+
self.click("form button span")
21+
self.sleep(2)
22+
self.click_if_visible("span.cursor-pointer", timeout=4)
1923
print("\n\nMy IP Address = %s\n" % ip_address)
2024
print("Displaying Host Info:")
21-
text = self.get_text("#widget-scrollable-container").split("asn:")[0]
25+
text = self.get_text("#block-summary").split("Hosted domains")[0]
26+
rows = text.split("\n")
27+
data = []
28+
for row in rows:
29+
if row.strip() != "":
30+
data.append(row.strip())
31+
print("\n".join(data).replace('\n"', " "))
32+
print("\nDisplaying Geolocation Info:")
33+
text = self.get_text("#block-geolocation").split("Coordinates")[0]
2234
rows = text.split("\n")
2335
data = []
2436
for row in rows:
2537
if row.strip() != "":
2638
data.append(row.strip())
2739
print("\n".join(data).replace('\n"', " "))
2840
if not self.headless:
29-
print("\nThe browser will close automatically in 7 seconds...")
30-
self.sleep(7)
41+
print("\nThe browser will close automatically in 3 seconds...")
42+
self.sleep(3)

examples/test_cdp_ad_blocking.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def test_cdp_network_blocking(self):
2424
]})
2525
self.execute_cdp_cmd('Network.enable', {})
2626
self.open('https://www.w3schools.com/jquery/default.asp')
27+
self.ad_block()
2728
source = self.get_page_source()
2829
self.assert_true("doubleclick.net" not in source)
2930
self.assert_true("google-analytics.com" not in source)

examples/youtube_search_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def test_youtube_autocomplete_results(self):
1111
self.skip("Unsupported mode for this test.")
1212
self.open("https://www.youtube.com/c/MichaelMintz")
1313
search_term = "seleniumbase"
14-
search_selector = "input#search"
14+
search_selector = 'input[name="search_query"]'
1515
results_selector = '[role="listbox"]'
1616
self.click_if_visible('button[aria-label="Close"]')
1717
self.double_click(search_selector)

0 commit comments

Comments
 (0)