O'Reilly logo

Selenium WebDriver Recipes in C#, Second Edition by Zhimin Zhan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 3

image

Hyperlink

Hyperlinks (or links) are fundamental elements of web pages. As a matter of fact, it is hyperlinks that make the World Wide Web possible. A sample link is shown in Figure 3-1 provided, followed by the HTML source.

9781484217412_Fig03-01.jpg

Figure 3-1. An example of a hyperlink

Click a link by text

Using text is probably the most direct way to click a link in Selenium, as it is what we see on the page.

driver.FindElement(By.LinkText("Recommend ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required