How can I fake/mock the Geolocation in the ChromeDriver through Selenium in C#?
I only examples for Python and Java but I cannot "translate" the code to C# because the used functions do not exist.
This is a example image of what I want to do:
The answer is YES! Websites can detect the automation using JavaScript experimental technology navigator. webdriver in the navigator interface.
In order to instantiate the object of ChromeDriver, you can simply create the object with the help of below command. Webdriver driver = New ChromeDriver(); The main motto of the ChromeDriver is to launch Google Chrome. Without that, it is not possible to execute Selenium test scripts in Google Chrome browser.
As Google Chrome dominates the browser market, the use of a ChromeDriver becomes a must. Selenium WebDriver uses the ChromeDriver to communicate test scripts with Google Chrome.
According to official, it seems not supported yet. https://sites.google.com/a/chromium.org/chromedriver/mobile-emulation
I can think of 2 options here
localState
capability. Note, you cannot change it on runtime.https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md https://chromedriver.chromium.org/capabilities
self.driver.set_location(49, 123, 10)
driver.Location.Altitude = 94.23;
driver.Location.Latitude = 121.21;
driver.Location.Longitude = 11.56;
http://appium.io/docs/en/commands/session/geolocation/set-geolocation/
To change the location whenever you like. I think this is the best way to do it anyway, even if it is easier to just use Chrome instead of configure Appium server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With