MCPcopy Index your code
hub / github.com/seleniumbase/SeleniumBase / test_geolocation

Method test_geolocation

examples/test_geolocation.py:18–46  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

16 super().tearDown()
17
18 def test_geolocation(self):
19 self.goto("about:blank")
20 if self._multithreaded:
21 self.skip("Skipping test in multi-threaded mode.")
22 if not self.is_chromium():
23 print("\n* execute_cdp_cmd() is only for Chromium browsers")
24 self.skip("execute_cdp_cmd() is only for Chromium browsers")
25 self.execute_cdp_cmd(
26 "Browser.grantPermissions",
27 {
28 "origin": "https://www.randymajors.org/",
29 "permissions": ["geolocation"],
30 },
31 )
32 self.execute_cdp_cmd(
33 "Emulation.setGeolocationOverride",
34 {
35 "latitude": 48.87645,
36 "longitude": 2.26340,
37 "accuracy": 100,
38 },
39 )
40 self.goto("https://www.randymajors.org/what-time-zone-am-i-in")
41 self.ad_block()
42 self.assert_text("Paris, France", "#statecountrylabel")
43 self.assert_text("Central European", "#currentlabel")
44 self.save_screenshot_to_logs()
45 if self.headed:
46 self.sleep(4)

Callers

nothing calls this directly

Calls 8

skipMethod · 0.80
is_chromiumMethod · 0.80
execute_cdp_cmdMethod · 0.80
ad_blockMethod · 0.80
gotoMethod · 0.45
assert_textMethod · 0.45
sleepMethod · 0.45

Tested by

no test coverage detected