Skip to content

Commit

Permalink
Set a pageload timeout for selenium
Browse files Browse the repository at this point in the history
  • Loading branch information
csrster committed Jan 28, 2022
1 parent 0211894 commit f217f6e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Expand Up @@ -115,7 +115,8 @@ protected void initialiseSelenium(){

//driver = new FirefoxDriver(fxProfile);
driver = new SeleniumSession<>();
driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(300, TimeUnit.SECONDS);
baseUrl = "http://" + testController.ENV.getGuiHost() + ":" + testController.ENV.getGuiPort();
PageHelper.initialize(driver, baseUrl);
testGUIController.waitForGUIToStart(600);
Expand Down
Expand Up @@ -70,10 +70,11 @@ public void waitForGUIToStart(int maxNumberOfSecondsToWait) {
System.out.println("Waited " + numberOfSecondsToWaiting + "/" + maxNumberOfSecondsToWait);
PageHelper.reloadSubPage("HarvestDefinition");
if (PageHelper.getWebDriver().getPageSource().contains("Menu")) {
System.out.println("Found Menu");
System.out.println();
return;
} else {
System.out.print(".");
System.out.print("Did not find Menu.");
}
try {
Thread.sleep(1000);
Expand Down
Expand Up @@ -84,7 +84,9 @@ public static void gotoSubPage(String subURL) {
*/
public static void reloadSubPage(String subURL) {
checkInitialization();
System.out.println("Loading subpage " + subURL);
driver.get(baseUrl + "/" + subURL);
System.out.println("Loaded subpage " + subURL);
}

public static void clickLink(String linkText) {
Expand Down

0 comments on commit f217f6e

Please sign in to comment.