Cannot find Chrome binary when executing a selenium (testng) test in jenkins on windows 7

后端 未结 13 1711
太阳男子
太阳男子 2020-12-29 10:22

I have a basic login test with selenium and testng. When executed from eclipse, it works as expected and invoke Google Chrome. If executed from TESTNG command line, it works

13条回答
  •  忘掉有多难
    2020-12-29 10:43

    It is possible that chrome is installed on your AppData (especially if your are on Windows 7). I am guessing Jenkins could not access the binary from your user directory. Make sure the directory you have Chrome on, is accessible to Jenkins, or try reinstalling chrome again to program files directory.

    On the other hand, you can simply instruct Chromedriver where to look for Chrome Binary,

    ChromeOptions chromeOptions= new ChromeOptions();
    chromeOptions.setBinary("C:\\ThePAthtoChrome.exe");
    
    ChromeDriver driver = new ChromeDriver(chromeOptions);
    

提交回复
热议问题