.net - 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 ?
解决方案
推荐阅读
- java - 为什么java的一些概念需要使用包装类而不是原始数据类型
- reactjs - Bootstrap 组件 reactstrap 和 react.Component 之间的连接
- javascript - 为什么在我的情况下 $(document).click 直接调用函数而不是附加事件处理程序?
- selenium - 一个具有多个不同 URL 的脚本来抓取信息
- javascript - 如何处理查询中字符串类型的打字稿错误
- swagger-ui - 按标签排序 - Redoc UI
- python - CNN 损失图中的奇怪行为
- sql - Oracle -SQL- 使用 where 条件根据长列表选择值
- scala - 设置 Scala 项目
- systemd - systemd 套接字激活侦听器程序结束行为