'No-Cache Refresh In Robot Framework Selenium2Library
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.
Solution 1:[1]
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
Solution 2:[2]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Andrea Bisello |
| Solution 2 | Community |
