Error When Running The Test in Azure DevOps | Selenium Training|Java|WebDriver|TestNG|Frameworks|Videos

Error When Running The Test in Azure DevOps

Y
youralok Post on 01/08/2019

I am getting following error whenever I am trying to run the tests on Azure DevOps cloud.

Though it sounds illogical, I tried to set path of my local machine, it did not work.

I already gave dependency for selenium and java in pom.xml, it did not work.

I also tried to upload the geckodriver online and used that path in pom.xmo, it did not work.

 

[ERROR] launchBrowser(example.DashboardAdmin) Time elapsed: 0.894 s <<< FAILURE!
java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html
    at example.DashboardAdmin.launchBrowser(DashboardAdmin.java:26)

S

Instructor

Support Team Reply on 02/08/2019

Have you set the web driver executable path in your code?

Y
youralok Reply on 05/08/2019

Here is the snippet of my code that is launching the browser fine when I run the test as TestNG, run as Maven in local, and individual .class file.
But, when I run the test in Azure DevOps cloud, it gives error as mentioned earlier.

 

@BeforeTest
    public void launchBrowser() {
        System.out.println("launching firefox browser");
        //System.setProperty("webdriver.gecko.driver", "geckodriver.exe");
        /*System.setProperty("webdriver.chrome.driver",
                "C:\\Users\\aagarwal\\Desktop\\AutomationFramework_2019\\jars\\chromedriver.exe");**/
        /*System.setProperty("webdriver.gecko.driver",
                "https://metrixlabeu.sharepoint.com/:u:/s/QASoftwareDevelopment/EZOrRx5FDoxLnlnAd7obNOIBcQY1mHkOre2mXg6CuLJ5RA?e=ykbhCG");*/
        /*System.setProperty("webdriver.ie.driver",
                "C:\\Users\\aagarwal\\OneDrive - Metrixlab US\\Desktop\\AutomationFramework_2019\\jars\\IEDriverServer.exe");*/

        //driver = new FirefoxDriver();
        driver = new ChromeDriver();
        driver.get(baseUrl);
    }

S

Instructor

Support Team Reply on 07/08/2019

As i noticed your code snippet, i can see that System.setproperty part for webdriver.gecko.driver is commented out which is causing the issue

Additionally, keep the executable directly in the system itself.

Y
youralok Reply on 28/11/2019

Please close this for now. Thanks.