Selenium.WebDriver.ChromeDriver-chromedriver.exe尚未针对netcore2.2目标框架发布

san*_*rni 1 c# selenium-chromedriver .net-core

我安装了nuget软件包-Selenium.WebDriver.ChromeDriver 2.46.0 ..当我发布(通过dotnet publish .Net CLI命令).csproject(目标框架-netcore2.2)时,chromedriver.exe不在输出/发布文件夹上复制..你能请人帮我吗?

Has*_*ang 5

从项目所有者的github页面:

默认配置下,“ chromedriver(.exe)”未包含在发布的文件中。此行为是设计使然。

如果要在发布的文件中包含“ chromedriver(.exe)”,请定义_PUBLISH_CHROMEDRIVER编译符号。

在此处输入图片说明

要么

PublishChromeDriver在MSBuild文件(.csproj,.vbproj等)中,将值定义为“ true”的属性以发布驱动程序文件。

<Project ...>
    ...
    <PropertyGroup>
      ...
      <PublishChromeDriver>true</PublishChromeDriver>
      ...
    </PropertyGroup>
...
</Project>
Run Code Online (Sandbox Code Playgroud)

注意:MSBuild属性始终会覆盖定义_PUBLISH_CHROMEDRIVER编译符号的条件