ChromeDriver does not exist in Selenium WebDriver C# test script

前端 未结 10 645
南旧
南旧 2021-02-01 02:24

I have come across a few people with the same issue that seemed to have solved the problem with System.addProperty(\"webdriver.chrome.driver\", \".../chromedriver.exe\");<

10条回答
  •  [愿得一人]
    2021-02-01 02:52

    This was a challenging one to isolate - the clue is in the nuget source which contains Selenium.WebDriver.ChromeDriver.targets - the targets requires an explicit property assignment so chromedriver.exe is never copied to vstest.console deployment directory. Here is the fix to add to your CSPROJ file:

    Assign PublishChromeDriver Property in CSPROJ

      
        MyUX.Tests
         
        True
      
    

    After this property is defined, a copy of chromedriver.exe will be copied to /bin for vstest.console. This fixes the error we were receiving:

    chromedriver.exe file does not exist in the current directory or in a directory on the PATH environment variable. The driver can be downloaded at http://chromedriver.storage.googleapis.com/index.html
    

    Alternative Approach - Force Copy in CSPROJ

      
        
        
      
    

提交回复
热议问题