Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Selenium 无法使用remoteWebdriver(如saucelab、privateGrid)设置地理位置_Selenium - Fatal编程技术网

Selenium 无法使用remoteWebdriver(如saucelab、privateGrid)设置地理位置

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中的异常

我试图在remoteWebdriver中设置地理位置,但我遇到了以下例外情况:它在ChromeDriver中工作

我使用的代码:

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,这怎么可能呢?还有其他配置吗?