The By partialLinkText is a method used with the Selenium WebDriver in Java in order to locate an element using a partial text of a link. This method selects the link having partial text from the given string.
Example:
Code snippet to locate an element using a partial link text in Selenium WebDriver:
// Launching the Chrome browser System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver"); WebDriver driver = new ChromeDriver();
// Opening the web page driver.get("https://www.example.com");
// Finding element by partial link text WebElement element = driver.findElement(By.partialLinkText("Exam"));
// Performing action on found element element.click();
// Closing the browser driver.quit(); }
}
In the above example, the By.partialLinkText method is used to locate an element with the partial link text "Exam" on the web page. The found element is clicked using the click() method. Finally, the browser is closed using the quit() method.
Package library: org.openqa.selenium.
Java By.partialLinkText - 18 examples found. These are the top rated real world Java examples of org.openqa.selenium.By.partialLinkText extracted from open source projects. You can rate examples to help us improve the quality of examples.