How to handle page load problem in Selenium WebDriver with Java?

620 views
Skip to first unread message

Abhishek Yadav

unread,
May 8, 2014, 1:54:50 AM5/8/14
to seleniu...@googlegroups.com
I am getting some page loading problem while executing my script.

Sometimes it happens that web page is not loaded.
And browser loading process is in progress.
Because of this next line of code not executed from my script.

I have already used following into my script:

    driver.manage().window().maximize();
    driver
.manage().timeouts().pageLoadTimeout(60, TimeUnit.SECONDS);
    driver
.manage().timeouts().setScriptTimeout(60, TimeUnit.SECONDS);


Please help into this, How I can stop the browser loading after a time difference?

Senthil Kumar

unread,
May 8, 2014, 8:19:11 AM5/8/14
to seleniu...@googlegroups.com
Abhishek,
I came across some couple of solutions .
You can wait for the element(Explicit wait).

WebDriverWait wait = new WebDriverWait(driver, 10); 
WebElement element = wait.until(ExpectedConditions.presenceOfElementLocated(By.id(>someid>)));

or you may use implicit wait to 
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

Shawn McCarthy

unread,
May 8, 2014, 12:10:27 PM5/8/14
to seleniu...@googlegroups.com
Which browser does it not work for ?

Lan Ta Bao

unread,
May 8, 2014, 9:56:55 PM5/8/14
to seleniu...@googlegroups.com
You need to try catch this exception.then if the exception is occur , you just need to enter a script like : driver.quit()

Vào 12:54:50 UTC+7 Thứ năm, ngày 08 tháng năm năm 2014, Abhishek Yadav đã viết:

Abhishek Yadav

unread,
May 9, 2014, 3:42:34 AM5/9/14
to seleniu...@googlegroups.com
Firefox

Oscar Rieken

unread,
Jul 3, 2014, 2:48:54 PM7/3/14
to seleniu...@googlegroups.com
I would probably find out why it takes so long and fix that. making a user wait more than 60 seconds for a page to load is a long time


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/cb8ba988-c1e2-4f61-9773-b35fa8e3b15a%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages