Selenium ChromeDriver is not published within the ZIP file

2021-01-29T12:53:26.16+00:00

Hi,
I'm using Selenium Chrome driver to do daily web scraping from different sites. The Function works fine when running in my notebook in emulator mode (I need to put the appropriate chromedriver.exe file by hand), but when published to Azure this file is removed (??), and the execution produces the following error message..

[The file D:\home\site\wwwroot\bin\chromedriver.exe does not exist. The driver can be downloaded at http://chromedriver.storage.googleapis.com/index.html]

I worked hours trying to solve this, with no results...
Many thanks for any advice.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,678 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Pramod Valavala 20,611 Reputation points Microsoft Employee
    2021-02-01T10:35:46.793+00:00

    This would depend on how you are deploying your function app. If you are manually zipping the files in your pipeline or from a local build, you could simply copy the exe to the folder before zipping.

    If you are using func azure functionapp publish locally, you could include the file by adding something like this in your csproj file.

    <Project Sdk="Microsoft.NET.Sdk">
      ...
      <ItemGroup>
        <None Update="host.json">
          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </None>
        ...
        <None Update="chromedriver.exe">
          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </None>
      </ItemGroup>
    </Project>
    
    0 comments No comments