【发布时间】:2021-12-31 20:39:43
【问题描述】:
问候 stackoverflow 社区,
我正在尝试从这个网站编译和运行程序代码:
我按照链接中列出的所有说明设置了我想要的路径。
程序和边缘驱动程序开始运行,但随后出现错误。
“WebDriver.dll 中出现错误异常“System.InvalidOperationException”。
更多信息:未创建会话:未找到匹配功能 (SessionNotCreated)"
这是我程序中的代码,或多或少是从上面的链接中复制的:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Edge;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Support.UI;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
var anaheimService = ChromeDriverService.CreateDefaultService(@"C:\edgedriver_win64", "msedgedriver.exe");
// user need to pass the driver path here....
var anaheimOptions = new ChromeOptions
{
// user need to pass the location of new edge app here....
BinaryLocation = @"
C: \Program Files(x86)\Microsoft\Edge\Application\msedge.exe "
};
IWebDriver driver = new ChromeDriver(anaheimService, anaheimOptions); -- error appears at this line
driver.Navigate().GoToUrl("https: //google.com/");
Console.WriteLine(driver.Title.ToString());
driver.Close();
}
}
}
非常感谢您的帮助!
最好的问候 最大
【问题讨论】:
-
嗨@blitzmax 这个问题怎么样? my answer below 对处理问题有帮助吗?如果有什么我可以在这里提供帮助的,请告诉我。
标签: c# microsoft-edge browser-automation