I have a helper class where I've initialised the chromedriver as well as set the driver implicit timeout to 10 seconds in its constructor:
public HelperClass {
System.setProperty("webdriver.chrome.driver", "src/resources/chromedriver");
chromeDriver = new ChromeDriver();
chromeDriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
In my test classes, I am also defining a HelperClass object:
public class Test {
public static HelperClass helper = new HelperClass();
Now if I have a test where a button with a link to another page is clicked and then another element within the new page is polled, the test will immediately fail since the new page has not been loaded yet. Shouldn't the browser wait for 10 seconds before it throws the error:
org.openqa.selenium.WebDriverException: unknown error: unhandled inspector error: {"code":-32000,"message":"Cannot find context with specified id"}
test:
helper.click(createNew);
helper.click(dropdownMenu);
<---fails on this. Works if I add an explicit wait right before this line
Any helper would be appreciated.