Navigate.Back() does not work properly with chrome/.net

2,825 views
Skip to first unread message

Daniel Aldridge

unread,
Apr 17, 2015, 3:54:28 AM4/17/15
to seleniu...@googlegroups.com
I have some tests in Java/Selenium/Eclipse/Testng and in those tests I use the webdriver.navigate().back() method, and it works fine.

I'm migrated some values to C#/Selenium and I'm utilizing the same web pages, and basically the same code, but the webdriver.navigate().back()
does not work.

Note: The url is always the same, no matter what page you are on. The Navigate().Back() works fine in Java, but not in C#.
What do you think?

Thanks!

Daniel Aldridge

unread,
Apr 19, 2015, 9:21:05 AM4/19/15
to seleniu...@googlegroups.com
Well I was able to trick it out.
WebDriver.Navigate().Back() does not work but executing some javascript does.


 ((IJavaScriptExecutor)webDriver).ExecuteScript("history.go(-1);", new Object[0]);

Whew!

Pavan Turlapati

unread,
Apr 20, 2015, 2:38:59 AM4/20/15
to seleniu...@googlegroups.com
Daniel:

Is this the case on both C# and Java?

Daniel Aldridge

unread,
Apr 20, 2015, 10:54:39 AM4/20/15
to seleniu...@googlegroups.com
Pavan,

No, It just works in Java. The issue is URL masking.. the url is always the same. In the utilizing the .net driver will bring you back
to the main page, whereas the Java driver will bring you back to the previous page.

thanks

Jim Evans

unread,
Apr 20, 2015, 2:06:47 PM4/20/15
to seleniu...@googlegroups.com
Given the architecture of the Chrome driver, differences in behavior between language bindings are exceedingly rare. Not discounting what you're seeing, but both the .NET and the Java language bindings are doing the exact same thing under the covers (making an HTTP request to http://localhost:<chromedriver.exe.port>/<sessionid>/back). It's up to chromedriver.exe to handle the actual navigation in Chrome.

Daniel Aldridge

unread,
Apr 20, 2015, 3:42:44 PM4/20/15
to seleniu...@googlegroups.com
Jim,

Thanks for the reply! Guess what, I have 2 different chromedrivers. One for the java environment and one for the .net environment. The java driver is from 11/25/2013, the .net driver is the most recent.  If I use the chromedriver from the Java environment in .net.. the BACK BUTTON WORKS FINE!!!!!!!  So that is the real issue.

Thanks!

--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/tbQpwimmRiU/unsubscribe.
To unsubscribe from this group and all its topics, 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/b4699bd3-22b6-4007-a8d1-f796b7365dc3%40googlegroups.com.

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

malireddy SrinivasaReddy

unread,
Aug 20, 2015, 9:17:52 AM8/20/15
to Selenium Users
Hi Daniel,

I am still having trouble with chrome browser not navigating back 

i have tried all the chrome driver releases at 


but still it's not navigating back to blank page

can you help me in this regard? please

Thanks
Reddy

Jegadeesh mani

unread,
Aug 20, 2015, 9:28:49 AM8/20/15
to seleniu...@googlegroups.com
Hi,

Use implicity wait or thread, it should work.

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.

Prerit Chandra

unread,
Apr 24, 2017, 10:26:55 AM4/24/17
to Selenium Users
Use :-
Thread.sleep(2000);
driver.navigate().back();
Reply all
Reply to author
Forward
0 new messages