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

后端 未结 13 1519
太阳男子
太阳男子 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:37

    I think you need to install chrome in your instance. for that you follow this basic commands

    wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
    sudo yum install ./google-chrome-stable_current_*.rpm
    
    google-chrome &
    
    0 讨论(0)
  • 2020-12-29 10:41

    I ran the following command to install chromedriver and it worked:

    brew cask install chromedriver
    
    0 讨论(0)
  • 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);
    
    0 讨论(0)
  • 2020-12-29 10:45

    I just check my chrome version (chrome://settings/help(85.0.4183.83 )) and then downloaded chromedriver.exe accordingly (https://chromedriver.chromium.org/downloads)and given new chrome driver.exe path...-This solves my same issue

    0 讨论(0)
  • 2020-12-29 10:46

    This code i tried it solved my one week unresolved problem,

    Thanks to Aastha Chopra..

    ChromeOptions chromeOptions= new ChromeOptions(); chromeOptions.setBinary("C:\Program Files (x86)\Google\Chrome Beta\Application\chrome.exe"); System.setProperty("webdriver.chrome.driver","C:\STUDY\Selenium\CHROMEDRIVERS\chromedriver.exe");

    ChromeDriver driver = new ChromeDriver(chromeOptions); driver.get("http://newtours.demoaut.com/");

    0 讨论(0)
  • 2020-12-29 10:46

    Mac users, Please make sure that chromeBinary file is placed at bin folder and chrome if it is in downloads move it to application.

    0 讨论(0)
提交回复
热议问题