(self)
| 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) |
nothing calls this directly
no test coverage detected