Locating Strategies with Partial Link Text on Various Browsers
Selenium Web Driver currently provides support for Google Chrome, Internet Explorer, Safari, Microsoft Edge, and Firefox Browser. The dependency we have used in this tutorial is sufficient for all of these drivers. If you wish to have only browser-specific libraries in your application, you could add the specific libraries for each of these drivers:
<!– https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-chrome-driver –><dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-chrome-driver</artifactId> <version>4.18.0</version></dependency>
2. IE Driver
<!– https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-ie-driver –><dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-ie-driver</artifactId> <version>4.18.0</version></dependency>
<!– https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-safari-driver –><dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-safari-driver</artifactId> <version>4.18.0</version></dependency>
<!– https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-edge-driver –><dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-edge-driver</artifactId> <version>4.18.0</version></dependency>
<!– https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-firefox-driver –><dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-firefox-driver</artifactId> <version>4.18.0</version></dependency>
Just add any of these for the browser that you want to automate and you are good to go.
Locating Strategies By Partial Link Text Using Java
Web application testing must be rigorous and thorough. For this reason, many tests for web applications are automated. Selenium is an open-source framework that allows us to automate web browser testing. In the following sections, we will use partial link text to locate elements on our HTML code using Java and Selenium. We will further see an example of how we can navigate to other web pages using automation.
Table of Content
- Steps for Locating Elements Using Partial Link Text in Java
- Locating Strategies with Partial Link Text on Various Browsers
- Conclusion
- Frequently Asked Questions on Locating Strategies By Partial Link Text Using Java
Locating elements using partial link text means we find the elements in our code that point to other web pages and are embedded in some text. This is different from link text because, in link text, you must know the exact text that you are looking for. The partial link text locator is used when you want to locate a piece or some anchor element whose text you don’t completely know.
If the partial link text finds more than one anchor tag containing the text being searched, it considers the first one only.
Contact Us