首页 > 解决方案 > The specified executable is not a valid application for this OS platform. Selenium.ChromeDriver, StartWithCreateProcess(ProcessStartInfo startInfo)

问题描述

My OS in Windows 10. I am trying to run Selenium project that was working fine around 3 years ago however I am running in the unexpected error message

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

Steps I have taken so far: Re-ran VS2015 as administrator and got same error, then checked if chromedriver.exe is there in the project directory, it is. Updated Nuget packages of Selenium.WebDriver.ChromeDriver to 74.0.3729.6, Selenium.WebDriver to 3.141, and Selenium.Support to 3.141 in vain.

Tried running it from a basic console application

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

same error.

After some research I have found this that due to some changes in .Net core I need to fire processes differently.

However, I am not in control of running .exe directly, this is done internally by ChromeDriver OpenQA.Selenium.Chrome.ChromeDriver..ctor(String chromeDriverDirectory, ChromeOptions options) and only parameters passed are directory and chrome running options...

Below is stack trace where error originated,

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() 

I am sure by now someone has managed to run Selenium with new changes.

How do I run Selenium ChromeDriver so it wouldn't break at creating the process at StartWithCreateProcess ?

标签: .netseleniumwindows-10selenium-chromedrivernuget-package

解决方案


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

没有工作的是

在此处输入图像描述

用以下铬替换它后被解雇了

在此处输入图像描述

一切又开始工作了。


推荐阅读