Thursday, February 22, 2024

Selenium Webdriver – Handling Images

Accessing Images Links 

In this tutorial, we learn about Handling images using Selenium Webdriver. Image links in web pages are the links that represent an image. When we click an image it navigates to a different window or a page. Since Image links have no link texts we cannot use the By.linkText() and By.partialLinkText() to access the image links. In this case, we use either By.cssSelector or By.Xpath.

Consider the below example, to access the “Facebook” logo on the upper left portion on Facebook’s Password Recovery page. 

Selenium Webdriver – Handling Images

Now, we will create a test case step by step to understand how to access the image.

Step 1: Launch the Eclipse IDE


No comments:

Post a Comment