Skip to content

Commit 320c6b6

Browse files
Python code added under Emulate Geo Location (SeleniumHQ#612)[deploy site]
* Python code added under Emulate Geo Location Working fine * Updated with requested changes Co-authored-by: JS31096 <12621691+JS31096@users.noreply.github.com>
1 parent 173ce29 commit 320c6b6

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

docs_source_files/content/support_packages/chrome_devtools.en.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,18 @@ public void geoLocationTest(){
2929
}
3030
{{< / code-panel >}}
3131
{{< code-panel language="python" >}}
32-
# Please raise a PR to add code sample
32+
from selenium import webdriver
33+
from selenium.webdriver.chrome.service import Service
34+
35+
def geoLocationTest():
36+
driver = webdriver.Chrome()
37+
Map_coordinates = dict({
38+
"latitude": 41.8781,
39+
"longitude": -87.6298,
40+
"accuracy": 100
41+
})
42+
driver.execute_cdp_cmd("Emulation.setGeolocationOverride", Map_coordinates)
43+
driver.get("<your site url>")
3344
{{< / code-panel >}}
3445
{{< code-panel language="csharp" >}}
3546
using System.Threading.Tasks;

0 commit comments

Comments
 (0)