selenium-manager.exe WebDriverException:在 wwwroot 文件夹 ASP.NET Core 中启动进程时出错

问题描述 投票:0回答:1

我正在尝试部署在无头模式下运行 selenium 实例的 ASP.NET Core 项目,它在开发中工作得很好,但是一旦我部署到 Azure 虚拟机,它就会不断给出以下错误:

处理请求时发生未处理的异常。 WebDriverException:Selenium Manager 进程异常退出,代码为 -1073740791:H:\wwwroot\myinvite.me\selenium-manager/windows/selenium-manager.exe --browser "chrome" --output json

OpenQA.Selenium.SeleniumManager.RunCommand(字符串文件名,字符串参数)

WebDriverException:启动过程出错:H:\wwwroot\myinvite.me\selenium-manager/windows/selenium-manager.exe --browser "chrome" --output json OpenQA.Selenium.SeleniumManager.RunCommand(字符串文件名,字符串参数)

NoSuchDriverException:无法使用Selenium Manager获取chrome;有关此错误的文档,请访问:https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location OpenQA.Selenium.DriverFinder.FullPath(DriverOptions 选项)

P.S:我尝试添加权限,因为我认为这是下载/写入 chromedriver 到 wwwroot 时的权限错误(我猜?因为我尝试在 powershell 管理员中手动运行该文件并且工作得很好)我去了 wwwroot 的安全选项卡文件夹并添加了应用程序池、默认池、我能想到的任何东西(也许)给允许的用户并授予完全权限。

asp.net-core selenium-webdriver webdeploy wwwroot
1个回答
0
投票

在 Azure 虚拟机上,检查是否可以访问错误中给出的 selenium 文档链接 (https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location)。

如果您无法在虚拟机上访问此链接,则意味着发生此错误,因为该 URL 在虚拟机上被阻止。如果需要,selenium-manager 在执行创建新驱动程序实例代码时下载驱动程序。对于所有这些任务,selenium-manager 可能使用类似的 URL,因此它需要访问该 URL。

对我来说,它就是我的 VPN。我使用 VPN 来运行代码,但我的 VPN 连接的区域不允许访问 selenium URL。一旦我关闭 VPN,一切就开始顺利运行。

© www.soinside.com 2019 - 2024. All rights reserved.