© Courtney Zhan, Edited by Zhimin Zhan 2024
Z. Zhan (ed.)Selenium WebDriver Recipes in C#https://doi.org/10.1007/979-8-8688-0023-8_9

9. Navigation and Browser

Courtney Zhan1  
(1)
Fitzgibbon, QLD, Australia
 

In Chapters 2 to 8, we covered driving common web controls. In this chapter, we will show you how to manage browser windows and page navigation in them.

Go to a URL

driver.Navigate().GoToUrl("https://google.com");
Alternatively, you can set the driver.Url property.
driver.Url = "https://testwisely.com";

Visit Pages Within a Site

driver.Navigate().GoToUrl() takes a full URL. Most of the time, testers work against a single site and specifying a full URL (such as https://...) is not necessary. You can create a reusable function to simplify its usage.

Get Selenium WebDriver Recipes in C#: Practical Testing Solutions for Selenium WebDriver now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.