October 28, 2024
Chicago 12, Melborne City, USA
java

Get URL before it's redirecting to the new URL


I’m writing this script where I need to retrieve a URL from the browser.
The testcase is, I first login to the website and click a button, and after the button click, it’ll automatically open up a new page. In this new page it’s initially having a URL and instantly it’s redirecting to a new URL. However, this process happens so fast. Therefore, I can’s retrieve the firstly generated URL using following code,

driver.getCurrentUrl();

How can I slow down the redirecting process so I can retrieve the original URL?

I’m doing this because, validating the original URL is part of the test requirement.

Thanks in advance.



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video