Selenium 无法使用remoteWebdriver(如saucelab、privateGrid)设置地理位置
我试图在remoteWebdriver中设置地理位置,但我遇到了以下例外情况:它在ChromeDriver中工作 我使用的代码:Selenium 无法使用remoteWebdriver(如saucelab、privateGrid)设置地理位置,selenium,Selenium,我试图在remoteWebdriver中设置地理位置,但我遇到了以下例外情况:它在ChromeDriver中工作 我使用的代码: WebDriver driver = new RemoteWebDriver(new URL(URL), caps); ((LocationContext) driver).setLocation(new Location(12.91072, 77.60998, 100)); 我犯了一个错误 线程主java.lang.ClassCastException中的异常
WebDriver driver = new RemoteWebDriver(new URL(URL), caps);
((LocationContext) driver).setLocation(new Location(12.91072, 77.60998, 100));
我犯了一个错误
线程主java.lang.ClassCastException中的异常:org.openqa.selenium.remote.RemoteWebDriver无法转换为org.openqa.selenium.html5.LocationContext
那古!
我以前也遇到过这个问题,我使用augmenter解决了它。
在您的情况下,它将类似于:
((LocationContext) new Augmenter().augment(getDriver())).setLocation(new Location(12.91072, 77.60998, 100));
您可以在中的fo中找到更多信息,即使使用增强器,我也会得到同样的ClassCastException,这怎么可能呢?还有其他配置吗?