3
votes

I have a test script written in python robot framework which navigates through a website and tests its pages. The website sometimes needs to refresh all its content from server, i.e. it needs a No-Cache Refresh.

Robot Framework selenium2library has a reload page method which simply performs a Refresh-If-Modified. In Python I can use driver.refresh() which does the same.

I tried Press Key in robot framework and driver.send_keys(Keys.COMMAND + Keys.F5) and driver.get(url) in python; none of them was successful!

Any idea how to do that??

To clarify, a No-Cache Refresh, retrieves all the website data from its server regardless of its changes on the server, but a Refresh-If-Modified first sends a request to the server and asks for changes, then it just requests to retrieve modified data.

2
which versions are using? - Rao
@Rao, robotframework-2.9, robotframework_selenium2library-1.7.3, python2.7; and my OS is windows 7 - 64 bit version. - Zeinab Abbasimazar
You mean clean browser cache? because you already seemed to tried out refresh page(hoping that worked) - Rao
@Rao, please review my edit. - Zeinab Abbasimazar
Sorry to come back again. What do you mean by No-Cache Refresh, Refresh-Is-Modify? are these keywords of Selenium2Library which I could not found though in the documentation? I can only find Reload Page. - Rao

2 Answers

0
votes

Chrome and Firefox handle in a different way the cache when robot by selenium launch those browsers.

to be sure browser cache is cleared, i use Close All Browsers keyword because it resets browser cache (http://robotframework.org/Selenium2Library/doc/Selenium2Library.html#Close%20All%20Browsers) and then i open the browser again.

so maybe you will use also Delete All Cookies keyword

0
votes

You could do it through javascript's location.reload(), passing true to the call - https://developer.mozilla.org/en-US/docs/Web/API/Location/reload

Execute Javascript    window.location.reload(true);

Yet YMMV - some browsers try to outsmart it, that's a common problem for the js devs.