Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (19.7k 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 (62.9k 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

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...