【问题标题】:The specified executable is not a valid application for this OS platform. Selenium.ChromeDriver, StartWithCreateProcess(ProcessStartInfo startInfo)指定的可执行文件不是此 OS 平台的有效应用程序。 Selenium.ChromeDriver, StartWithCreateProcess(ProcessStartInfo startInfo)
【发布时间】:2019-05-12 05:30:41
【问题描述】:

我在 Windows 10 中的操作系统。我正在尝试运行大约 3 年前运行良好的 Selenium 项目,但是我运行时出现意外错误消息

The specified executable is not a valid application for this OS platform.

到目前为止我采取的步骤:以管理员身份重新运行 VS2015 并得到相同的错误,然后检查项目目录中是否存在 chromedriver.exe,是的。 更新了 Selenium.WebDriver.ChromeDriver to 74.0.3729.6Selenium.WebDriver to 3.141Selenium.Support to 3.141 的 Nuget 包是徒劳的。

尝试从基本的控制台应用程序运行它

static void Main(string[] args)
    {
        using (var crawler = new Crawler())
        {
            crawler.Navigate("https://www.google.com");
        }
    }

同样的错误。

经过一些研究,我 have found this 认为由​​于 .Net 核心的一些变化,我需要以不同的方式启动进程。

但是,我无法控制直接运行 .exe,这是由 ChromeDriver OpenQA.Selenium.Chrome.ChromeDriver..ctor(String chromeDriverDirectory, ChromeOptions options) 在内部完成的,传递的参数只有目录和 chrome 运行选项...

下面是错误产生的堆栈跟踪,

at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at OpenQA.Selenium.DriverService.Start()
at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
at OpenQA.Selenium.Chrome.ChromeDriver..ctor(String chromeDriverDirectory, ChromeOptions options)
at WebAnalyzer.Controllers.HomeController.About() 

我确信现在有人已经设法通过新的更改来运行 Selenium。

如何运行 Selenium ChromeDriver,这样它就不会在 StartWithCreateProcess 创建进程时中断?

【问题讨论】:

  • 你的操作系统是什么? chromedriver 版本?
  • @Guy Hello Guy,windows 10,chromedriver 2.20 版,selenium webdriver 2.53 将 win 10 添加到标签,感谢您的建议。我们说话时我正在更新 selenium nuget
  • @Guy 更新了 nugets,仍然得到完全相同的错误
  • chromedriver 2.20 是古老的,更新它以及chromedriver.chromium.org/downloads。确保版本与浏览器版本匹配。

标签: .net selenium windows-10 selenium-chromedriver nuget-package


【解决方案1】:

问题是我用来获取 chromedriver.exe 的 NuGet 包

那个没用的是

用下面的 chrome 替换它后被解雇了

一切又开始工作了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-07-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-09
    • 2016-10-11
    • 2018-03-30
    • 1970-01-01
    相关资源
    最近更新 更多