Before I run my TestNG suite I would like to check that Chrome and Edge webdriver are up to date and stop the TestNG suite if the browser can't be lauched.
My code so far is,
EdgeDriver driver2 = new EdgeDriver();
StartBrowser.driver(driver2, prop2);
LogFile.logfile("Perform Second logon to Edge Browser");
if(!LogonUser.logonButton(driver2).isEnabled())
{
LogFile.logfile("Logon button not detected for Edge, assuming webdriver is out of date");
System.exit(2);
}
LogFile.logfile("Logon button detected, webdriver is assumed to be valid for Edge");
At the point this line, "EdgeDriver driver2 = new EdgeDriver();" runs, it goes into the TestInvoker.class and the test stops and goes on to the next @test.
Is there a way of testing the webdriver before instantiating it?
Or perhaps I'm looking at the solution in the wrong way?
Many Thanks.
CodePudding user response:
You can use WebDriverManager.
This will insure your WebDriver
is always updated automatically.