【发布时间】:2014-12-13 19:44:03
【问题描述】:
我编写自动化系统并在 localhost 中完美运行,但是当我尝试发布它并上传到服务器时。我收到了这个错误;
unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64)
我对这条路有 10 亿的把握,这是我的代码
var outPutDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase);
var options = new ChromeOptions();
var driverPath = Path.Combine(outPutDirectory, "ChromeDriverInThisFolder\\");
string driver_path = new Uri(driverPath).LocalPath;
driver = new ChromeDriver(driver_path, options);
我的服务器是 windows Windows NT 6.1 SP1 x86_64 2008 R2 企业版 64 位
【问题讨论】:
-
在您放置 chromedriver.exe 的服务器中?
-
@TeknoBilSoft,消息很清楚:chromedriver.exe 不在“D:\PathTo”中。
-
你试过不通过路径吗?只是“驱动程序=新的ChromeDriver(选项);” ?
-
我有,然后我得到这个错误;附加信息:当前目录或 PATH 环境变量的目录中不存在 chromedriver.exe 文件。驱动可以在chromedriver.storage.googleapis.com/index.html下载。
-
你能不能把chromedriver移到c:,然后在code e里改路径再试试。
标签: c# selenium webdriver selenium-chromedriver