英文:
I can't navigate with Edge using Selenium
问题
我正在尝试使用Java Selenium启动Edge浏览器:
if (browser.equals("edge")) {
System.setProperty("webdriver.edge.driver", driverPath + "\\MicrosoftWebDriver\\MicrosoftWebDriver.exe");
driver = new EdgeDriver();
}
但我遇到了这个异常:无法启动新会话。可能的原因是远程服务器的地址无效或浏览器启动失败。
[11:25:55.747] - 在 http://localhost:25602/ 上监听
[Ljava.lang.StackTraceElement;@4d98e41b
org.openqa.selenium.remote.UnreachableBrowserException: 无法启动新会话。可能的原因是远程服务器的地址无效或浏览器启动失败。
Build info: version: '4.0.0-alpha-6', revision: '5f43a29cfc'
System info: host: 'EB00477', ip: '192.168.6.214', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '14.0.1'
Driver info: driver.version: EdgeDriver
无法启动新会话。可能的原因是远程服务器的地址无效或浏览器启动失败。
Build info: version: '4.0.0-alpha-6', revision: '5f43a29cfc'
System info: host: 'EB00477', ip: '192.168.6.214', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '14.0.1'
Driver info: driver.version: EdgeDriver
我的Edge版本是:Microsoft Edge 44.18362.449.0,Microsoft EdgeHTML 18.18363
我尝试使用了MicrosoftWebDriver.exe
和msedgedriver.exe
文件,但它们都无法工作。如何让它工作?
英文:
I'm trying to start Edge browser with Java Selenium:
if(browser.equals("edge")) {
System.setProperty("webdriver.edge.driver", driverPath+"\\MicrosoftWebDriver\\MicrosoftWebDriver.exe");
driver = new EdgeDriver();
}
but i have this exception: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
[11:25:55.747] - Listening on http://localhost:25602/
[Ljava.lang.StackTraceElement;@4d98e41b
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '4.0.0-alpha-6', revision: '5f43a29cfc'
System info: host: 'EB00477', ip: '192.168.6.214', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '14.0.1'
Driver info: driver.version: EdgeDriver
Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '4.0.0-alpha-6', revision: '5f43a29cfc'
System info: host: 'EB00477', ip: '192.168.6.214', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '14.0.1'
Driver info: driver.version: EdgeDriver
My Edge version is:Microsoft Edge 44.18362.449.0,Microsoft EdgeHTML 18.18363
I tried using both MicrosoftWebDriver.exe
and msedgedriver.exe
file, they don't work.
How can I make it work?
答案1
得分: 0
看起来代码是正确的,但WebDriver和Edge版本不匹配。
我从https://www.microsoft.com/it-it/edge安装了Edge,然后我访问了https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/并下载了正确的驱动程序版本。我必须使用 msedgedriver.exe
我的代码是:
if(browser.equals("edge")) {
System.setProperty("webdriver.edge.driver", driverPath+"\\MicrosoftWebDriver\\msedgedriver.exe");
driver = new EdgeDriver();
}
英文:
It looks like that the code is ok, while WebDriver and Edge versions were not matching.
I installed Edge from https://www.microsoft.com/it-it/edge then I went to https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ and downloaded the correct Driver version. I have to use msedgedriver.exe
My code is:
if(browser.equals("edge")) {
System.setProperty("webdriver.edge.driver", driverPath+"\\MicrosoftWebDriver\\msedgedriver.exe");
driver = new EdgeDriver();
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论