Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.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,无法指向Microsoft Edge中的页面。WebDriverException:无法分析远程响应:未知错误_Selenium_Selenium Webdriver_Webdriver_Microsoft Edge - Fatal编程技术网

由于selenium,无法指向Microsoft Edge中的页面。WebDriverException:无法分析远程响应:未知错误

由于selenium,无法指向Microsoft Edge中的页面。WebDriverException:无法分析远程响应:未知错误,selenium,selenium-webdriver,webdriver,microsoft-edge,Selenium,Selenium Webdriver,Webdriver,Microsoft Edge,我启动了web驱动程序并尝试连接URL,但它返回异常 发生的情况是:打开web浏览器,但不指向给定的Url,并在控制台日志上打印错误 我的代码如下所示: Webdriver driver = new EdgeDriver(); driver.get("https://docs.microsoft.com/en-us/welcome-to-docs"); 错误日志: Webdriver driver = new EdgeDriver(); driver.get("https://docs.m

我启动了web驱动程序并尝试连接URL,但它返回异常 发生的情况是:打开web浏览器,但不指向给定的Url,并在控制台日志上打印错误

我的代码如下所示

Webdriver driver  = new EdgeDriver();
driver.get("https://docs.microsoft.com/en-us/welcome-to-docs");
错误日志

Webdriver driver  = new EdgeDriver();
driver.get("https://docs.microsoft.com/en-us/welcome-to-docs");
org.openqa.selenium.WebDriverException:无法分析远程响应:未知错误

位于org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:115)

位于org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:74)

位于org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)


我启用了开发者模式

我已经在(C:\WINDOWS\system32>)中使用以下命令安装了WebDriver: DISM.exe/Online/Add Capability/CapabilityName:Microsoft.WebDriver~~~~~0.0.1.0

我使用以下版本:

  • 硒版本:“3.141.59”

  • 浏览器:Microsoft Edge,版本80.0.361.50(正式版本) (64位)

  • 操作系统版本:18362.535

  • Windows版本:10版本1903

对此有什么想法吗?

DISM.exe/联机/添加功能 /CapabilityName:Microsoft.WebDriver~~~~~0.0.1.0

使用上述命令将安装适用于Microsoft Edge旧版18的Microsoft WebDriver,但不适用于Microsoft Edge版本80.0.361.50(正式版本)(64位)

您可以根据Edge版本号从下载相关的Microsoft Edge WebDriver

编辑:

尝试使用EdgeOptions设置webdriver路径,代码如下:

using OpenQA.Selenium.Edge;
using OpenQA.Selenium.Remote;

        // EdgeOptions() requires using OpenQA.Selenium.Edge
        // Construct EdgeOptions with is_legacy = false
        EdgeOptions edgeOptions = new EdgeOptions(false);
        edgeOptions.BinaryLocation = @"C:\Program Files (x86)\Microsoft\Edge Beta\Application\msedge.exe"; 
        var msedgedriverDir = @"<download webdriver folder such as:D:\MicrosoftEdgeDriver\edgedriver_win64>";
        var msedgedriverExe = @"msedgedriver.exe";

        // Construct EdgeDriverService with is_legacy = false too
        var service = EdgeDriverService.CreateDefaultService(msedgedriverDir, msedgedriverExe, false);
        service.EnableVerboseLogging = true;

        var driver = new EdgeDriver(service, edgeOptions);

        driver.Navigate().GoToUrl("https://bing.com");
        Thread.Sleep(2000);

        driver.Close(); 
使用OpenQA.Selenium.Edge;
使用OpenQA.Selenium.Remote;
//EdgeOptions()需要使用OpenQA.Selenium.Edge
//使用is_legacy=false构造EdgeOptions
EdgeOptions EdgeOptions=新的EdgeOptions(假);
edgeOptions.BinaryLocation=@“C:\ProgramFiles(x86)\Microsoft\Edge Beta\Application\msedge.exe”;
变量msedgedriverDir=@”;
var msedgedriverex=@“msedgedriver.exe”;
//使用is_legacy=false构造EdgeDriverService
var service=EdgeDriverService.CreateDefaultService(msedgedriverDir,msedgedriverExe,false);
service.EnableVerboseLogging=true;
var驱动器=新的边缘驱动器(服务、边缘选项);
driver.Navigate().gotour(“https://bing.com");
《睡眠》(2000年);
driver.Close();
有关使用Chromium版本Edge WebDriver的更多详细信息,请查看以下链接:


似乎仍然没有发布此版本的web驱动程序:浏览器:Microsoft Edge,版本80.0.361.50(正式版本)(64位)os Build:18362.535如果仍然使用原始web驱动程序,则可以检查上面的编辑代码,并使用EdgeOptions设置下载web驱动程序路径和边缘路径,然后创建EdgeDriver对象。