MCPcopy Create free account
hub / github.com/seleniumbase/SeleniumBase / test_proxy

Method test_proxy

examples/proxy_test.py:7–49  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

5
6class ProxyTests(BaseCase):
7 def test_proxy(self):
8 if self.headless or self.recorder_mode or self.browser == "safari":
9 self.goto_if_not_url("about:blank")
10 print("\n Unsupported mode for this test.")
11 self.skip("Unsupported mode for this test.")
12 settings.SKIP_JS_WAITS = True
13 self.goto("https://api.ipify.org/")
14 ip_address = self.get_text("body")
15 if "ERR" in ip_address:
16 raise Exception("Failed to determine IP Address!")
17 print("\n\nMy IP Address = %s\n" % ip_address)
18 self.goto("https://ipinfo.io/%s" % ip_address)
19 self.sleep(2)
20 self.wait_for_text(ip_address, "h1", timeout=20)
21 self.wait_for_element_present('[href="/signup"]')
22 self.wait_for_text("Hosted domains", timeout=20)
23 self.highlight("h1")
24 pop_up = '[role="dialog"] span.cursor-pointer'
25 self.click_if_visible(pop_up)
26 self.highlight("section#summary")
27 self.click_if_visible(pop_up)
28 self.highlight("section#geolocation")
29 self.click_if_visible(pop_up)
30 self.sleep(2)
31 print("Displaying Host Info:")
32 text = self.get_text("#summary").split("Hosted domains")[0]
33 rows = text.split("\n")
34 data = []
35 for row in rows:
36 if row.strip() != "":
37 data.append(row.strip())
38 print("\n".join(data).replace('\n"', ' "'))
39 print("\nDisplaying GeoLocation Info:")
40 text = self.get_text("#geolocation")
41 text = text.split("IP Geolocation data")[0]
42 rows = text.split("\n")
43 data = []
44 for row in rows:
45 if row.strip() != "":
46 data.append(row.strip())
47 print("\n".join(data).replace('\n"', ' "'))
48 self.click_if_visible(pop_up)
49 self.sleep(3)

Callers

nothing calls this directly

Calls 9

skipMethod · 0.80
goto_if_not_urlMethod · 0.45
gotoMethod · 0.45
get_textMethod · 0.45
sleepMethod · 0.45
wait_for_textMethod · 0.45
highlightMethod · 0.45
click_if_visibleMethod · 0.45

Tested by

no test coverage detected