0 votes
1 view
in DevOps and Agile by (19.8k points)

In my application when sign-in, then it navigates to another page. Now I need to get that new URL using WebDriver in Selenium C#.

I can't find any function to do this. I have tried driver.Urldriver.getLocation() and driver.getCurrentUrl(), but nothing is working in my C# application. So is it possible to get the current URL somehow? After it gets navigated?

1 Answer

0 votes
by (63.4k points)
edited by

You can instantiate your browser driver and use the object instance to get the URL and store it in a string data type variable.

Code snippet:

IWebDriver driver = new FirefoxDriver(); String currentURL = driver.Url;

If you are interested to learn Selenium on a much deeper level and want to become a professional in the testing domain, check out Intellipaat’s automation testing certification

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...