Ways to refresh page using selenium to load a web element

93 views
Skip to first unread message

Manish Kumar

unread,
Apr 12, 2016, 12:55:01 PM4/12/16
to Selenium Users
Hi 

I am doing refresh to load a web element which takes time to get loaded.
I have tried following ways to refresh page using selenium API:

1) driver.get(driver.getCurrentUrl());
2) action.keyDown(Keys.CONTROL).sendKeys(Keys.F5).perform();
3) driver.navigate().refresh();
4) driver.navigate().to(driver.getCurrentUrl());

But, I am facing the error that "Unable to communicate with server" using all of the above options.
Please suggest how to resolve this issue.

Thanks,
Manish

Jegadeesh mani

unread,
Apr 12, 2016, 11:20:42 PM4/12/16
to seleniu...@googlegroups.com

Hi manish,

Might be your internet connection will be slow

Or

Use the explicit wait condition, after refresh the page.

Thanks
Jegadeesh

--
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/f55b6c9c-bcff-4362-a7b5-d81abbe9fd00%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

pranab singh

unread,
Apr 13, 2016, 1:14:43 AM4/13/16
to seleniu...@googlegroups.com

Hi can u try implicitly wait and also the pageload timeout..
Hope it may be helpful..

Regards
Pranab Chetri

Manish Kumar

unread,
Apr 18, 2016, 7:36:50 AM4/18/16
to Selenium Users
Hi

I tried both of the options mentioned by you, but it din't work. Apart from that I tried following code to remove unnecessary error popup containing error message,"Unable to communicate with server":
            FirefoxProfile profile = new FirefoxProfile();
            DesiredCapabilities dc = DesiredCapabilities.firefox();
            profile.setPreference("capability.policy.policynames", "strict");
            profile.setPreference("capability.policy.strict.sites", "http://10.131.40.138:7080/agora/main.action");
            profile.setPreference("capability.policy.strict.Window.alert", "noAccess");
            profile.setPreference("capability.policy.strict.Window.confirm", "noAccess");
            profile.setPreference("capability.policy.strict.Window.prompt", "noAccess");

            dc = DesiredCapabilities.firefox();
            dc.setCapability(FirefoxDriver.PROFILE, profile);
            
            driver = new FirefoxDriver(dc);

Please suggest what I am missing.

Thanks
Manish
Reply all
Reply to author
Forward
0 new messages