How to Identify Elements using LinkText and PartialLinkText II Automation II Selenium

Опубликовано: 28 Сентябрь 2024
на канале: Knowledge Share
122
3

In this Session you will learn how to Identify Elements using LinkText and Partial Link Text
This is most useful session If you want to learn how to find number of links on a web page and also print those links.

Program
======================
package com.seleniumbasics;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class Locators_Linktext_PartialLinktex_example

{
public static void main(String args[])
{
System.setProperty("webdriver.chrome.driver","E:\\Selenium + Java - Youtube\\Selenium\\Libraries\\chromedriver_win32\\chromedriver.exe");

//Creating object for Webdriver
WebDriver driver=new ChromeDriver();


// Opening Google.com
driver.navigate().to("http://demowebshop.tricentis.com/");

// Maximise the Browser
driver.manage().window().maximize();

System.out.println("Demowebshop opened succesfully");

//driver.findElement(By.linkText("Register")).click();

//System.out.println("Navigated to Registrtaion page ");


//driver.findElement(By.linkText("Log in")).click();

driver.findElement(By.partialLinkText("Log")).click();

}
}