Reputation: 3
I'm trying to set geoLocation in remoteWebdriver But i'm getting below exception.its working in ChromeDriver();
Code i used:
WebDriver driver = new RemoteWebDriver(new URL(URL), caps);
((LocationContext) driver).setLocation(new Location(12.91072, 77.60998, 100));
Error I am getting
Exception in thread "main" java.lang.ClassCastException: org.openqa.selenium.remote.RemoteWebDriver cannot be cast to org.openqa.selenium.html5.LocationContext
Upvotes: 0
Views: 568
Reputation: 11
Nagu! I also have this issue before and I resolved it using augmenter. In your case it would be something like:
((LocationContext) new Augmenter().augment(getDriver())).setLocation(new Location(12.91072, 77.60998, 100));
You can find more in fo in https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/remote/Augmenter.html
Upvotes: 1