Reputation: 705
I'm doing some test cases using selenium in Java/Firefox and sometimes the QA server hangs. After clicking the login button, it's still on the same page, doesn't get to the next page, and the loading spinner spins forever. Now my only option so far is to manually refresh even though these are meant to be automated.
I've tried
driver.navigate().refresh();
as well as
((JavascriptExecutor)driver).executeScript("document.location.reload()");
They don't seem to work in-between pages. Is there a better way to refresh the page that does not depend of the state of loading?
Upvotes: 3
Views: 1989
Reputation: 21
Try to get the URL after imputing details and access it again, basically, you are automating the refresh, for example:
String baseUrl = "sampleweb.com"
driver.get(baseUrl);
driver.findElements(By.cssSelector("username"))
driver.sendKeys("yourusername");
String refresh = driver.getCurrentUrl();
driver.get(refresh);
Upvotes: 2
Reputation: 392
According to your question, setting up timeouts won't help and you have already tried 2 methods.
I can suggest trying using keyboard shortcuts (use those that you need). I would check them manually of course before implementing code solution. Pressing on keys with Java should not be a problem, with awt.Robot
for example.
Upvotes: 0