0
votes

We are using Seleniumquery-0.19.0 for our selenium tests.

we noticed that $.url() is not waiting for page to load completely. I also tried $.driver().get().navigate().to(url);.

our Scenario,

  1. open the page.
  2. search for login controls i.e user and password text box
  3. fill value and click on submit button.

In the test result we found that selenium is not able to find the Username text box. we tried with

  1. waits i.e. $("*[id='login.username']").waitUntil(5000).isPresent();
  2. timeouts i.e. $.driver().get().manage().timeouts().pageLoadTimeout(60, TimeUnit.SECONDS);
  3. static void waitForPageLoad(final WebDriver wdriver) { final WebDriverWait wait = new WebDriverWait(wdriver, 600);

    final Function<WebDriver, Boolean> pageLoaded = new Function<WebDriver, Boolean>() {
    
        @Override
        public Boolean apply(final WebDriver input) {
            final Boolean result =
                ((JavascriptExecutor)input).executeScript("return document.readyState").equals("complete");
            LOG.info("Status of the Page : " + result);
    
            return result;
        }
    };
    
    wait.until(pageLoaded);
    

    }

1
do you have a Single Page App which is loading it's content through ajax?Josef Biehler
No, its not a SPA.Naveen Kumar Gautam
ok. I have tested your selector with the waituntil() line and it works for my code. Can you provide more html code?Josef Biehler

1 Answers

0
votes

Have you tried using Thread.sleep(ms) after navigating to the URL.