selenium - selenium 错误 WebDriverException:未知错误:asp 核心中没有 chrome 二进制文件
问题描述
我在 asp core 3.1 中使用 selenium,在本地它正在工作,但在 server windows 2012 中出现错误:
WebDriverException:未知错误:没有 chrome 二进制文件
我设置二进制和驱动程序:
var chromeOptions = new ChromeOptions();
chromeOptions.BinaryLocation = @"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe";
_driver = new ChromeDriver(Path.Combine(hostingEnvironment.WebRootPath), chromeOptions);
但不工作
解决方案
在本地这有效,因为它是与您的系统相关的绝对路径。
chromeOptions.BinaryLocation = @"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe";
这当然不会在服务器上工作,因为这会失败,因为它不是同一条路径。理想情况下,您希望使用相对路径样式。
推荐阅读
- docker - Azure devops:错误 NU1101:找不到包 xxx。源中不存在具有此 ID 的包:nuget.org
- pandas - 创建新的日期时间列 pandas
- python-3.x - 从名字列表中创建一个“玩家”并给他们自己的独立列表
- foursquare - 如何使用 Foursquare API 编辑场地?
- reactjs - 缩小我的 React 代码时如何保留注释?
- javascript - 通过套接字 io 的实时音频流。alsa关机,如何解决?
- c++ - ignite C++ 客户端是否支持发布订阅
- java - SessionNotCreatedException:试图通过 Java 使用 Selenium GeckoDriver 和 Firefox 运行命令而不建立连接错误
- ios - 如何根据文本字段中的用户输入过滤字典数据数组
- django - 加载失败