我是新來使用Selenium,而我只是一個簡單的腳本來打開邊去開始谷歌:的Java /硒:簡單的程序打開邊緣失敗(依賴問題?)
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.edge.EdgeDriver;
public class openEdge
{
public static void main(String[] args)
{
System.setProperty("webdriver.edge.driver","E:\\Program Files
(x86)\\Microsoft Web Driver\\MicrosoftWebDriver.exe");
WebDriver driver = new EdgeDriver();
System.out.println("here");
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.get("https://www.google.com");
}
}
當我運行這個,邊緣打開成功,但它似乎失敗後創建Webdriver實例(即不打印「這裏」)。這是我的錯誤:
Exception in thread "main" org.openqa.selenium.NoSuchSessionException: null (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 358 milliseconds
其次是建立和系統信息,然後爲EdgeDriver駕駛員信息一個長長的清單。我已經添加了依賴到硒客戶端和服務器罐子。任何幫助,將不勝感激!
編輯:根據要求構建,系統和驅動程序信息。我現在注意到,構建信息都是未知的,我猜這與它有關。我會嘗試重新下載我的所有依賴項:
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'myname', ip: 'myip', os.name: 'Windows 10',
os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_131'
Driver info: driver.version: EdgeDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:215)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$22(ProtocolHandshake.java:365)
at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Unknown Source)
at java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source)
at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.util.stream.FindOps$FindOp.evaluateSequential(Unknown Source)
at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.util.stream.ReferencePipeline.findFirst(Unknown Source)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:368)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:159)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:250)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:137)
at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:150)
at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:139)
at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:96)
at openEdge.openEdge.main(openEdge.java:16)
IMO進一步分析,我們需要從您的控制檯看到確切的'構建和系統信息,然後一長串驅動程序信息的EdgeDriver'。 – DebanjanB