Spread the love

What is the defference between driver.navigate().refresh() and pressing F5?

Spread the love

I was going through a forum and found one of my mate tried to refresh a page after doing some operation in web. He used..


But this code was failing while running the code. I was googling for a suggestion or help and finally found one solution in stackoverflow..

Being interested , I observed all the possible causes and agreed the discussion there. The summary I found is as below:

It’s not exactly equivalent to pressing F5 though. driver.navigate().refresh() in its request header says “no-cache” and, as a result, unconditionally reloads all content. Whereas pressing F5 could result in a “If-Modified-Since” request, that could get a “304 Not Modified” response.

Wow that is what I was looking for. Since this page is based on ajax so F5 was not working there. When I have used


It worked like a boom.

Also for pressing F5, we have one more option..

Actions actionObject = new Actions(driver);

Hope that helps.

Spread the love
READ  How To Start And Stop Selenium Server From Eclipse
Animesh Chatterjeehttps://techtravelhub.com/
I am the founder and owner of the blog - TechTravelHub.com, always love to share knowledge on test automation,tools,techniques and tips.I am a passionate coder of Java and VBScript.I also publish articles on Travel ideas and great honeymoon destinations.Apart from these, I am a gear-head,love to drive across India. I have shared lots of articles here on How to travel several parts of India.Customization of cars aka car modification is my another hobby.Get in touch with me on ani01104@gamil.com

Related Articles

How to Resolve NoSuchSessionException in selenium free?

How to Resolve NoSuchSessionException in selenium? NoSuchSessionException in Selenium is a tricky...


  1. I signed up for several lessons (the 10 lessons package which was pretty good and signed up for few more additional lessons). Just took my driving test last Thursday and passed on my first try!


Please enter your comment!
Please enter your name here

Recent Posts

Super Keyword in Java Simplified

Super Keyword Super Keyword in Java Simplified: Java defines a special...

Learn Object Repository in UFT in An Efficient and Fast Manner

Object Repository in UFT The post will cover the following...

Learn What Primary Tools For Test Automation

Primary Tools For Test Automation According to the Gartner report...


Spread the love
READ  JSoup A Nice Initiative To Fetch Information From HTML