{"id":93312,"date":"2019-06-21T10:00:00","date_gmt":"2019-06-21T07:00:00","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=93312"},"modified":"2019-06-20T10:39:04","modified_gmt":"2019-06-20T07:39:04","slug":"find-elements-link-text-partial-link-text-selenium","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2019\/06\/find-elements-link-text-partial-link-text-selenium.html","title":{"rendered":"Find Elements With Link Text &amp; Partial Link Text In Selenium"},"content":{"rendered":"<p>CSS locators in Selenium are a fundamental concept that every tester who aims to perform automation testing with Selenium, should be aware of. Proficient use of CSS locators in Selenium can help you perform testing in a more efficient &amp; thorough manner. I have been in the automation testing industry from 7 years now, &amp; I often observe that testers when performing <a href=\"https:\/\/www.lambdatest.com\/selenium-automation\" target=\"_blank\" rel=\"noopener noreferrer\">automation testing with Selenium<\/a>, tend to forget the purpose of each CSS locator. Freshers have a tough time understanding them &amp; experienced tester often stick to a couple selectors for locating elements on a webpage as they execute automation testing with Selenium.<\/p>\n<p>There have been times where I see an experienced automation tester taking a longer route for finding an element as they have a habit of sticking to their favourite locator. It is why I thought I would come up with a tutorial series for CSS locators in Selenium to help budding automation testers come up with a strategic implementation of these locators. And to those of us who are experienced, it would be a quick and good recap.<\/p>\n<p>This article will represent the practical implementation of link text &amp; partial link text, as we perform automation testing with Selenium. The links on any web application can help in locating an element with either exact match of the text or through partial match. Using link text &amp; partial link text in Selenium, we will be able to locate both of these matches. This is the last article of my tutorial series on CSS Locator in Selenium.<\/p>\n<p>You can check out other articles around different CSS locator in Selenium that helps in locating elements through various ways:<\/p>\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.lambdatest.com\/blog\/making-the-move-with-id-locator-in-selenium-webdriver\/\" target=\"_blank\" rel=\"noopener noreferrer\">ID locator in Selenium<\/a><\/li>\n<li><a href=\"https:\/\/www.lambdatest.com\/blog\/how-to-use-name-locator-in-selenium-automation-scripts\/\" target=\"_blank\" rel=\"noopener noreferrer\">Name locator in Selenium<\/a><\/li>\n<li><a href=\"https:\/\/www.lambdatest.com\/blog\/selenium-java-tutorial-class-name-locator-in-selenium\/\" target=\"_blank\" rel=\"noopener noreferrer\">Class Name locator in Selenium<\/a><\/li>\n<li><a href=\"https:\/\/www.lambdatest.com\/blog\/how-to-use-name-locator-in-selenium-automation-scripts\/\" target=\"_blank\" rel=\"noopener noreferrer\">Tagname locator in Selenium<\/a><\/li>\n<li><a href=\"https:\/\/www.lambdatest.com\/blog\/how-pro-testers-use-css-selectors-in-selenium-automation-scripts\/\" target=\"_blank\" rel=\"noopener noreferrer\">CSS Selector in Selenium<\/a><\/li>\n<li><a href=\"https:\/\/www.lambdatest.com\/blog\/complete-guide-for-using-xpath-in-selenium-with-examples\/\" target=\"_blank\" rel=\"noopener noreferrer\">XPath in Selenium<\/a><\/li>\n<\/ul>\n<p>If you are an advanced or medium Selenium practitioner, then you can chuck on dedicated articles mentioned above. And go for our complete guide to help you illustrate the practical demonstration of CSS locator in Selenium.<\/p>\n<p><a href=\"https:\/\/www.lambdatest.com\/blog\/locators-in-selenium-webdriver-with-examples\/\" target=\"_blank\" rel=\"noopener noreferrer\">Check Out My Complete Guide For Every CSS Locator In Selenium WebDriver With Examples<\/a><\/p>\n<p>With that said, let\u2019s find out how to leverage link text &amp; partial link text in Selenium to locate elements on a web page.<\/p>\n<h2 class=\"wp-block-heading\">Using Link Text In Selenium To Locate An Element<\/h2>\n<p>In order to access link using link text in Selenium, the below-referenced code is used:<br \/><code>driver.findElement(By.linkText(\"this is a link text\"));<\/code><\/p>\n<p><b>Note:<\/b> In a scenario where, multiple links having similar text exists, it will automatically select the first one.<\/p>\n<p>Let\u2019s refer the code snippet below to understand the use case. In this case, we are taking Airbnb example, where we are clicking on any one stay of Goa through the link match.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" width=\"768\" height=\"432\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/pasted-image-0-20.png\" alt=\"Partial Link Text\" class=\"wp-image-93401\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/pasted-image-0-20.png 768w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/pasted-image-0-20-300x169.png 300w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/figure>\n<\/div>\n<p>Referenced screenshot of the div element with the link text:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" width=\"604\" height=\"60\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/image1-1-1.png\" alt=\"Partial Link Text\" class=\"wp-image-93402\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/image1-1-1.png 604w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/image1-1-1-300x30.png 300w\" sizes=\"(max-width: 604px) 100vw, 604px\" \/><\/figure>\n<\/div>\n<div>\n<div id=\"highlighter_420501\" class=\"syntaxhighlighter  java\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">01<\/div>\n<div class=\"line number2 index1 alt1\">02<\/div>\n<div class=\"line number3 index2 alt2\">03<\/div>\n<div class=\"line number4 index3 alt1\">04<\/div>\n<div class=\"line number5 index4 alt2\">05<\/div>\n<div class=\"line number6 index5 alt1\">06<\/div>\n<div class=\"line number7 index6 alt2\">07<\/div>\n<div class=\"line number8 index7 alt1\">08<\/div>\n<div class=\"line number9 index8 alt2\">09<\/div>\n<div class=\"line number10 index9 alt1\">10<\/div>\n<div class=\"line number11 index10 alt2\">11<\/div>\n<div class=\"line number12 index11 alt1\">12<\/div>\n<div class=\"line number13 index12 alt2\">13<\/div>\n<div class=\"line number14 index13 alt1\">14<\/div>\n<div class=\"line number15 index14 alt2\">15<\/div>\n<div class=\"line number16 index15 alt1\">16<\/div>\n<div class=\"line number17 index16 alt2\">17<\/div>\n<div class=\"line number18 index17 alt1\">18<\/div>\n<div class=\"line number19 index18 alt2\">19<\/div>\n<div class=\"line number20 index19 alt1\">20<\/div>\n<div class=\"line number21 index20 alt2\">21<\/div>\n<div class=\"line number22 index21 alt1\">22<\/div>\n<div class=\"line number23 index22 alt2\">23<\/div>\n<div class=\"line number24 index23 alt1\">24<\/div>\n<div class=\"line number25 index24 alt2\">25<\/div>\n<div class=\"line number26 index25 alt1\">26<\/div>\n<div class=\"line number27 index26 alt2\">27<\/div>\n<div class=\"line number28 index27 alt1\">28<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"java keyword\">import<\/code> <code class=\"java plain\">java.util.concurrent.TimeUnit;<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"java spaces\">&nbsp;<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"java keyword\">import<\/code> <code class=\"java plain\">org.openqa.selenium.By;<\/code><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"java keyword\">import<\/code> <code class=\"java plain\">org.openqa.selenium.WebDriver;<\/code><\/div>\n<div class=\"line number5 index4 alt2\"><code class=\"java keyword\">import<\/code> <code class=\"java plain\">org.openqa.selenium.chrome.ChromeDriver;<\/code><\/div>\n<div class=\"line number6 index5 alt1\"><code class=\"java keyword\">import<\/code> <code class=\"java plain\">org.testng.Assert;<\/code><\/div>\n<div class=\"line number7 index6 alt2\"><code class=\"java spaces\">&nbsp;<\/code><\/div>\n<div class=\"line number8 index7 alt1\"><code class=\"java keyword\">public<\/code> <code class=\"java keyword\">class<\/code> <code class=\"java plain\">LinkText {<\/code><\/div>\n<div class=\"line number9 index8 alt2\"><code class=\"java spaces\">&nbsp;<\/code><\/div>\n<div class=\"line number10 index9 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;<\/code><code class=\"java keyword\">public<\/code> <code class=\"java keyword\">static<\/code> <code class=\"java keyword\">void<\/code> <code class=\"java plain\">main(String[] args) {<\/code><\/div>\n<div class=\"line number11 index10 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java comments\">\/\/ TODO Auto-generated method stub<\/code><\/div>\n<div class=\"line number12 index11 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><\/div>\n<div class=\"line number13 index12 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">System.setProperty(<\/code><code class=\"java string\">\"webdriver.chrome.driver\"<\/code><code class=\"java plain\">, <\/code><code class=\"java string\">\".\\\\ChromeDriver\\\\chromedriver.exe\"<\/code><code class=\"java plain\">);<\/code><\/div>\n<div class=\"line number14 index13 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">WebDriver driver=<\/code><code class=\"java keyword\">new<\/code> <code class=\"java plain\">ChromeDriver();<\/code><\/div>\n<div class=\"line number15 index14 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">driver.manage().timeouts().implicitlyWait(<\/code><code class=\"java value\">20<\/code><code class=\"java plain\">, TimeUnit.SECONDS);<\/code><\/div>\n<div class=\"line number16 index15 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><\/div>\n<div class=\"line number17 index16 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">driver.manage().window().maximize();<\/code><\/div>\n<div class=\"line number18 index17 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><\/div>\n<div class=\"line number19 index18 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java comments\">\/\/Opening the air bnb Goa homestays page<\/code><\/div>\n<div class=\"line number20 index19 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">driver.get(<\/code><code class=\"java string\">\"<a href=\"https:\/\/www.airbnb.co.in\/s\/Goa\/all\">https:\/\/www.airbnb.co.in\/s\/Goa\/all<\/a>\"<\/code><code class=\"java plain\">);<\/code><\/div>\n<div class=\"line number21 index20 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><\/div>\n<div class=\"line number22 index21 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java comments\">\/\/locating an element via link text in Selenium now, and clicking on that stay<\/code><\/div>\n<div class=\"line number23 index22 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">driver.findElement(By.linkText(<\/code><code class=\"java string\">\"Standard One Bedroom Suite with Pool &amp;amp; Jacuzzi\"<\/code><code class=\"java plain\">)).click();<\/code><\/div>\n<div class=\"line number24 index23 alt1\"><code class=\"java spaces\">&nbsp;<\/code><\/div>\n<div class=\"line number25 index24 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">driver.quit();<\/code><\/div>\n<div class=\"line number26 index25 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;<\/code><code class=\"java plain\">}<\/code><\/div>\n<div class=\"line number27 index26 alt2\"><code class=\"java spaces\">&nbsp;<\/code><\/div>\n<div class=\"line number28 index27 alt1\"><code class=\"java plain\">}<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>We can locate the same element using partial link text in Selenium as well. Let\u2019s check how!<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h2 class=\"wp-block-heading\">Using Partial Link Text In Selenium To Locate An Element<\/h2>\n<p>Partial link text in Selenium is another way of locating an element via a link. The only difference from the link text in Selenium to partial link text is that <b>it does not look into the exact match of the string value but work on a partial match<\/b>. So, in case you are looking for a link with a bigger text length, you can get away from using only the partial link text rather than the whole link text in Selenium.<\/p>\n<p>Syntax of locating element by partial link text.<\/p>\n<p><code>driver.findElement(By.partialLinkText (\"link text\"));<\/code><\/p>\n<p>Referencing the above scenario, below is the code snippet for partial link text of the same stay of Airbnb:<\/p>\n<div>\n<div id=\"highlighter_218039\" class=\"syntaxhighlighter  java\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">01<\/div>\n<div class=\"line number2 index1 alt1\">02<\/div>\n<div class=\"line number3 index2 alt2\">03<\/div>\n<div class=\"line number4 index3 alt1\">04<\/div>\n<div class=\"line number5 index4 alt2\">05<\/div>\n<div class=\"line number6 index5 alt1\">06<\/div>\n<div class=\"line number7 index6 alt2\">07<\/div>\n<div class=\"line number8 index7 alt1\">08<\/div>\n<div class=\"line number9 index8 alt2\">09<\/div>\n<div class=\"line number10 index9 alt1\">10<\/div>\n<div class=\"line number11 index10 alt2\">11<\/div>\n<div class=\"line number12 index11 alt1\">12<\/div>\n<div class=\"line number13 index12 alt2\">13<\/div>\n<div class=\"line number14 index13 alt1\">14<\/div>\n<div class=\"line number15 index14 alt2\">15<\/div>\n<div class=\"line number16 index15 alt1\">16<\/div>\n<div class=\"line number17 index16 alt2\">17<\/div>\n<div class=\"line number18 index17 alt1\">18<\/div>\n<div class=\"line number19 index18 alt2\">19<\/div>\n<div class=\"line number20 index19 alt1\">20<\/div>\n<div class=\"line number21 index20 alt2\">21<\/div>\n<div class=\"line number22 index21 alt1\">22<\/div>\n<div class=\"line number23 index22 alt2\">23<\/div>\n<div class=\"line number24 index23 alt1\">24<\/div>\n<div class=\"line number25 index24 alt2\">25<\/div>\n<div class=\"line number26 index25 alt1\">26<\/div>\n<div class=\"line number27 index26 alt2\">27<\/div>\n<div class=\"line number28 index27 alt1\">28<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"java keyword\">import<\/code> <code class=\"java plain\">java.util.concurrent.TimeUnit;<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"java spaces\">&nbsp;<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"java keyword\">import<\/code> <code class=\"java plain\">org.openqa.selenium.By;<\/code><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"java keyword\">import<\/code> <code class=\"java plain\">org.openqa.selenium.WebDriver;<\/code><\/div>\n<div class=\"line number5 index4 alt2\"><code class=\"java keyword\">import<\/code> <code class=\"java plain\">org.openqa.selenium.chrome.ChromeDriver;<\/code><\/div>\n<div class=\"line number6 index5 alt1\"><code class=\"java keyword\">import<\/code> <code class=\"java plain\">org.testng.Assert;<\/code><\/div>\n<div class=\"line number7 index6 alt2\"><code class=\"java spaces\">&nbsp;<\/code><\/div>\n<div class=\"line number8 index7 alt1\"><code class=\"java keyword\">public<\/code> <code class=\"java keyword\">class<\/code> <code class=\"java plain\">PartialLinkText {<\/code><\/div>\n<div class=\"line number9 index8 alt2\"><code class=\"java spaces\">&nbsp;<\/code><\/div>\n<div class=\"line number10 index9 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;<\/code><code class=\"java keyword\">public<\/code> <code class=\"java keyword\">static<\/code> <code class=\"java keyword\">void<\/code> <code class=\"java plain\">main(String[] args) {<\/code><\/div>\n<div class=\"line number11 index10 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java comments\">\/\/ TODO Auto-generated method stub<\/code><\/div>\n<div class=\"line number12 index11 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><\/div>\n<div class=\"line number13 index12 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">System.setProperty(<\/code><code class=\"java string\">\"webdriver.chrome.driver\"<\/code><code class=\"java plain\">, <\/code><code class=\"java string\">\".\\\\ChromeDriver\\\\chromedriver.exe\"<\/code><code class=\"java plain\">);<\/code><\/div>\n<div class=\"line number14 index13 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">WebDriver driver=<\/code><code class=\"java keyword\">new<\/code> <code class=\"java plain\">ChromeDriver();<\/code><\/div>\n<div class=\"line number15 index14 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">driver.manage().timeouts().implicitlyWait(<\/code><code class=\"java value\">20<\/code><code class=\"java plain\">, TimeUnit.SECONDS);<\/code><\/div>\n<div class=\"line number16 index15 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><\/div>\n<div class=\"line number17 index16 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">driver.manage().window().maximize();<\/code><\/div>\n<div class=\"line number18 index17 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><\/div>\n<div class=\"line number19 index18 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java comments\">\/\/Opening the air bnb Goa homestays page<\/code><\/div>\n<div class=\"line number20 index19 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">driver.get(<\/code><code class=\"java string\">\"<a href=\"https:\/\/www.airbnb.co.in\/s\/Goa\/all\">https:\/\/www.airbnb.co.in\/s\/Goa\/all<\/a>\"<\/code><code class=\"java plain\">);<\/code><\/div>\n<div class=\"line number21 index20 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><\/div>\n<div class=\"line number22 index21 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java comments\">\/\/locating an element via link text now and clicking on that stay<\/code><\/div>\n<div class=\"line number23 index22 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">driver.findElement(By.partialLinkText(<\/code><code class=\"java string\">\"Pool &amp;amp; Jacuzzi\"<\/code><code class=\"java plain\">)).click();<\/code><\/div>\n<div class=\"line number24 index23 alt1\"><code class=\"java spaces\">&nbsp;<\/code><\/div>\n<div class=\"line number25 index24 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">driver.quit();<\/code><\/div>\n<div class=\"line number26 index25 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;<\/code><code class=\"java plain\">}<\/code><\/div>\n<div class=\"line number27 index26 alt2\"><code class=\"java spaces\">&nbsp;<\/code><\/div>\n<div class=\"line number28 index27 alt1\"><code class=\"java plain\">}<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3 class=\"wp-block-heading\">How To Select The Right Link Text When You Have Multiple Match Results?<\/h3>\n<p>The only thing to remember and to be cautious of while using partial link text in Selenium is when partial link text ends up matching with multiple link text on the page. In this case, make sure, you are clicking on the desired one.<\/p>\n<p>Let\u2019s consider another scenario as we perform automation testing with Selenium, where you end up matching multiple link text and wish to target only the designated one. For the same homestays of Goa, I am trying to locate the element with partial text as \u2018pool\u2019 in it. So, the strategy would be to find out home many stays have a pool in them and click on the required stay, post that. The reference code snippet below represents how we can pick the right target out of multiple match results using the partial link text in Selenium.<\/p>\n<div>\n<div id=\"highlighter_184325\" class=\"syntaxhighlighter  java\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">01<\/div>\n<div class=\"line number2 index1 alt1\">02<\/div>\n<div class=\"line number3 index2 alt2\">03<\/div>\n<div class=\"line number4 index3 alt1\">04<\/div>\n<div class=\"line number5 index4 alt2\">05<\/div>\n<div class=\"line number6 index5 alt1\">06<\/div>\n<div class=\"line number7 index6 alt2\">07<\/div>\n<div class=\"line number8 index7 alt1\">08<\/div>\n<div class=\"line number9 index8 alt2\">09<\/div>\n<div class=\"line number10 index9 alt1\">10<\/div>\n<div class=\"line number11 index10 alt2\">11<\/div>\n<div class=\"line number12 index11 alt1\">12<\/div>\n<div class=\"line number13 index12 alt2\">13<\/div>\n<div class=\"line number14 index13 alt1\">14<\/div>\n<div class=\"line number15 index14 alt2\">15<\/div>\n<div class=\"line number16 index15 alt1\">16<\/div>\n<div class=\"line number17 index16 alt2\">17<\/div>\n<div class=\"line number18 index17 alt1\">18<\/div>\n<div class=\"line number19 index18 alt2\">19<\/div>\n<div class=\"line number20 index19 alt1\">20<\/div>\n<div class=\"line number21 index20 alt2\">21<\/div>\n<div class=\"line number22 index21 alt1\">22<\/div>\n<div class=\"line number23 index22 alt2\">23<\/div>\n<div class=\"line number24 index23 alt1\">24<\/div>\n<div class=\"line number25 index24 alt2\">25<\/div>\n<div class=\"line number26 index25 alt1\">26<\/div>\n<div class=\"line number27 index26 alt2\">27<\/div>\n<div class=\"line number28 index27 alt1\">28<\/div>\n<div class=\"line number29 index28 alt2\">29<\/div>\n<div class=\"line number30 index29 alt1\">30<\/div>\n<div class=\"line number31 index30 alt2\">31<\/div>\n<div class=\"line number32 index31 alt1\">32<\/div>\n<div class=\"line number33 index32 alt2\">33<\/div>\n<div class=\"line number34 index33 alt1\">34<\/div>\n<div class=\"line number35 index34 alt2\">35<\/div>\n<div class=\"line number36 index35 alt1\">36<\/div>\n<div class=\"line number37 index36 alt2\">37<\/div>\n<div class=\"line number38 index37 alt1\">38<\/div>\n<div class=\"line number39 index38 alt2\">39<\/div>\n<div class=\"line number40 index39 alt1\">40<\/div>\n<div class=\"line number41 index40 alt2\">41<\/div>\n<div class=\"line number42 index41 alt1\">42<\/div>\n<div class=\"line number43 index42 alt2\">43<\/div>\n<div class=\"line number44 index43 alt1\">44<\/div>\n<div class=\"line number45 index44 alt2\">45<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"java keyword\">import<\/code> <code class=\"java plain\">java.util.List;<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"java keyword\">import<\/code> <code class=\"java plain\">java.util.concurrent.TimeUnit;<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"java spaces\">&nbsp;<\/code><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"java keyword\">import<\/code> <code class=\"java plain\">org.openqa.selenium.By;<\/code><\/div>\n<div class=\"line number5 index4 alt2\"><code class=\"java keyword\">import<\/code> <code class=\"java plain\">org.openqa.selenium.WebDriver;<\/code><\/div>\n<div class=\"line number6 index5 alt1\"><code class=\"java keyword\">import<\/code> <code class=\"java plain\">org.openqa.selenium.WebElement;<\/code><\/div>\n<div class=\"line number7 index6 alt2\"><code class=\"java keyword\">import<\/code> <code class=\"java plain\">org.openqa.selenium.chrome.ChromeDriver;<\/code><\/div>\n<div class=\"line number8 index7 alt1\"><code class=\"java keyword\">import<\/code> <code class=\"java plain\">org.testng.Assert;<\/code><\/div>\n<div class=\"line number9 index8 alt2\"><code class=\"java spaces\">&nbsp;<\/code><\/div>\n<div class=\"line number10 index9 alt1\"><code class=\"java keyword\">public<\/code> <code class=\"java keyword\">class<\/code> <code class=\"java plain\">LinkText {<\/code><\/div>\n<div class=\"line number11 index10 alt2\"><code class=\"java spaces\">&nbsp;<\/code><\/div>\n<div class=\"line number12 index11 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;<\/code><code class=\"java keyword\">public<\/code> <code class=\"java keyword\">static<\/code> <code class=\"java keyword\">void<\/code> <code class=\"java plain\">main(String[] args) {<\/code><\/div>\n<div class=\"line number13 index12 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java comments\">\/\/ TODO Auto-generated method stub<\/code><\/div>\n<div class=\"line number14 index13 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><\/div>\n<div class=\"line number15 index14 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">System.setProperty(<\/code><code class=\"java string\">\"webdriver.chrome.driver\"<\/code><code class=\"java plain\">, <\/code><code class=\"java string\">\".\\\\ChromeDriver\\\\chromedriver.exe\"<\/code><code class=\"java plain\">);<\/code><\/div>\n<div class=\"line number16 index15 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">WebDriver driver=<\/code><code class=\"java keyword\">new<\/code> <code class=\"java plain\">ChromeDriver();<\/code><\/div>\n<div class=\"line number17 index16 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">driver.manage().timeouts().implicitlyWait(<\/code><code class=\"java value\">20<\/code><code class=\"java plain\">, TimeUnit.SECONDS);<\/code><\/div>\n<div class=\"line number18 index17 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><\/div>\n<div class=\"line number19 index18 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">driver.manage().window().maximize();<\/code><\/div>\n<div class=\"line number20 index19 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><\/div>\n<div class=\"line number21 index20 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java comments\">\/\/Opening the air bnb Goa homestays page<\/code><\/div>\n<div class=\"line number22 index21 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">driver.get(<\/code><code class=\"java string\">\"<a href=\"https:\/\/www.airbnb.co.in\/s\/Goa\/all\">https:\/\/www.airbnb.co.in\/s\/Goa\/all<\/a>\"<\/code><code class=\"java plain\">);<\/code><\/div>\n<div class=\"line number23 index22 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><\/div>\n<div class=\"line number24 index23 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java comments\">\/\/locating an element via link text now and clicking on that stay<\/code><\/div>\n<div class=\"line number25 index24 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">List&amp;lt;WebElement&amp;gt; poolNumber=driver.findElements(By.partialLinkText(<\/code><code class=\"java string\">\"Pool\"<\/code><code class=\"java plain\">));<\/code><\/div>\n<div class=\"line number26 index25 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><\/div>\n<div class=\"line number27 index26 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java comments\">\/\/find the number of links with the text as pool<\/code><\/div>\n<div class=\"line number28 index27 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java keyword\">int<\/code> <code class=\"java plain\">numberOfStaysWithPool= poolNumber.size();<\/code><\/div>\n<div class=\"line number29 index28 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><\/div>\n<div class=\"line number30 index29 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">System.out.println(numberOfStaysWithPool);<\/code><\/div>\n<div class=\"line number31 index30 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><\/div>\n<div class=\"line number32 index31 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java keyword\">for<\/code><code class=\"java plain\">(<\/code><code class=\"java keyword\">int<\/code> <code class=\"java plain\">k=<\/code><code class=\"java value\">0<\/code><code class=\"java plain\">; k&amp;lt;numberOfStaysWithPool; k++)<\/code><\/div>\n<div class=\"line number33 index32 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">{<\/code><\/div>\n<div class=\"line number34 index33 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java comments\">\/\/printing all those links<\/code><\/div>\n<div class=\"line number35 index34 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">System.out.println(poolNumber.get(k).getText());<\/code><\/div>\n<div class=\"line number36 index35 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><\/div>\n<div class=\"line number37 index36 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">}<\/code><\/div>\n<div class=\"line number38 index37 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><\/div>\n<div class=\"line number39 index38 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java comments\">\/\/select the luxury three bedroom apartment link<\/code><\/div>\n<div class=\"line number40 index39 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">poolNumber.get(<\/code><code class=\"java value\">2<\/code><code class=\"java plain\">).click();<\/code><\/div>\n<div class=\"line number41 index40 alt2\"><code class=\"java spaces\">&nbsp;<\/code><\/div>\n<div class=\"line number42 index41 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">driver.quit();<\/code><\/div>\n<div class=\"line number43 index42 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;<\/code><code class=\"java plain\">}<\/code><\/div>\n<div class=\"line number44 index43 alt1\"><code class=\"java spaces\">&nbsp;<\/code><\/div>\n<div class=\"line number45 index44 alt2\"><code class=\"java plain\">}<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" width=\"604\" height=\"316\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/image2-1-2.png\" alt=\"Partial Link Text\" class=\"wp-image-93403\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/image2-1-2.png 604w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/image2-1-2-300x157.png 300w\" sizes=\"(max-width: 604px) 100vw, 604px\" \/><\/figure>\n<\/div>\n<p>In the above code snippet, I have used <b>findElements<\/b> since I am supposed to receive multiple web elements with partial text as \u2018pool\u2019. Now, using an index, I have navigated to one of the links, which I wish to click. Simple, isn\u2019t it?<\/p>\n<p><b>Note:<\/b> Both, link text &amp; partial link text are cases sensitive as CSS locator in Selenium.<\/p>\n<p>For example, Assume that a link \u2018<b>Register<\/b>\u2019 is present on a home page and a similar link \u2018<b>REGISTER<\/b>\u2019 is present on the footer of the homepage. In this case, if you are locating with link text \u2018<b>REGISTER<\/b>\u2019, it will automatically select the link in the footer and not the other one.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/accounts.lambdatest.com\/register\/\"><img decoding=\"async\" width=\"431\" height=\"330\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/cta-img-1.png\" alt=\"Class Name Locator\" class=\"wp-image-93389\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/cta-img-1.png 431w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/cta-img-1-300x230.png 300w\" sizes=\"(max-width: 431px) 100vw, 431px\" \/><\/a><\/figure>\n<\/div>\n<p>Link text and partial link text locator in Selenium works only on links of a given web application. If you intend to locate elements other than links you cannot use link text or partial link text locator in Selenium. If you are dealing with links in your application, then this is perhaps the best locator to go with. Happy testing! <\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/accounts.lambdatest.com\/register\/\"><img decoding=\"async\" width=\"768\" height=\"149\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/Adword-Cyber2-2.jpg\" alt=\"Partial Link Text\" class=\"wp-image-93404\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/Adword-Cyber2-2.jpg 768w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/Adword-Cyber2-2-300x58.jpg 300w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n<\/div>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td>Published on Java Code Geeks with permission by Sadhvi Singh, partner at our <a href=\"\/\/www.javacodegeeks.com\/join-us\/jcg\/\" target=\"_blank\" rel=\"noopener noreferrer\">JCG program<\/a>. See the original article here: <a href=\"https:\/\/www.lambdatest.com\/blog\/using-link-text-and-partial-link-text-in-selenium\/\" target=\"_blank\" rel=\"noopener noreferrer\">Find Elements With Link Text &amp; Partial Link Text In Selenium<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Opinions expressed by Java Code Geeks contributors are their own.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>CSS locators in Selenium are a fundamental concept that every tester who aims to perform automation testing with Selenium, should be aware of. Proficient use of CSS locators in Selenium can help you perform testing in a more efficient &amp; thorough manner. I have been in the automation testing industry from 7 years now, &amp; &hellip;<\/p>\n","protected":false},"author":86855,"featured_media":231,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[287],"class_list":["post-93312","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-selenium"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Find Elements With Link Text &amp; Partial Link Text In Selenium - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Interested to learn about Partial Link Text? Check our article explaining how to Find Elements With Link Text &amp; Partial Link Text In Selenium\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2019\/06\/find-elements-link-text-partial-link-text-selenium.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Find Elements With Link Text &amp; Partial Link Text In Selenium - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Interested to learn about Partial Link Text? Check our article explaining how to Find Elements With Link Text &amp; Partial Link Text In Selenium\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2019\/06\/find-elements-link-text-partial-link-text-selenium.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2019-06-21T07:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/selenium-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sadhvi Singh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sadhvi Singh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/06\\\/find-elements-link-text-partial-link-text-selenium.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/06\\\/find-elements-link-text-partial-link-text-selenium.html\"},\"author\":{\"name\":\"Sadhvi Singh\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/c161d28b654426f5f53205d3e5741592\"},\"headline\":\"Find Elements With Link Text &amp; Partial Link Text In Selenium\",\"datePublished\":\"2019-06-21T07:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/06\\\/find-elements-link-text-partial-link-text-selenium.html\"},\"wordCount\":977,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/06\\\/find-elements-link-text-partial-link-text-selenium.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/selenium-logo.jpg\",\"keywords\":[\"Selenium\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/06\\\/find-elements-link-text-partial-link-text-selenium.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/06\\\/find-elements-link-text-partial-link-text-selenium.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/06\\\/find-elements-link-text-partial-link-text-selenium.html\",\"name\":\"Find Elements With Link Text &amp; Partial Link Text In Selenium - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/06\\\/find-elements-link-text-partial-link-text-selenium.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/06\\\/find-elements-link-text-partial-link-text-selenium.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/selenium-logo.jpg\",\"datePublished\":\"2019-06-21T07:00:00+00:00\",\"description\":\"Interested to learn about Partial Link Text? Check our article explaining how to Find Elements With Link Text &amp; Partial Link Text In Selenium\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/06\\\/find-elements-link-text-partial-link-text-selenium.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/06\\\/find-elements-link-text-partial-link-text-selenium.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/06\\\/find-elements-link-text-partial-link-text-selenium.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/selenium-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/selenium-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/06\\\/find-elements-link-text-partial-link-text-selenium.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Find Elements With Link Text &amp; Partial Link Text In Selenium\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/c161d28b654426f5f53205d3e5741592\",\"name\":\"Sadhvi Singh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bb8228ad0652dddd0649786b1b414bd85838ad14e20d439a8ee4aa51d416dba3?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bb8228ad0652dddd0649786b1b414bd85838ad14e20d439a8ee4aa51d416dba3?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bb8228ad0652dddd0649786b1b414bd85838ad14e20d439a8ee4aa51d416dba3?s=96&d=mm&r=g\",\"caption\":\"Sadhvi Singh\"},\"description\":\"Sadhvi Singh is a QA Manager. In 7 years of her professional journey, she has worked on multiple domains and testing techniques like Automation testing, Database testing, API testing, Manual testing, and Security testing. With multiple tools exposure added to her experience, she has skilled herself further through her two major accolades at International level through ISTQB with foundation and advanced levels. She has a technical blog named as qavibes.blogspot.com where she caters to all the challenges offered in the day to day journey of the quality assurance aspirants. In her spare time, she also works as a technical trainer and mentor to many budding QA professionals.\",\"sameAs\":[\"https:\\\/\\\/www.lambdatest.com\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/sadhvi-singh\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Find Elements With Link Text &amp; Partial Link Text In Selenium - Java Code Geeks","description":"Interested to learn about Partial Link Text? Check our article explaining how to Find Elements With Link Text &amp; Partial Link Text In Selenium","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2019\/06\/find-elements-link-text-partial-link-text-selenium.html","og_locale":"en_US","og_type":"article","og_title":"Find Elements With Link Text &amp; Partial Link Text In Selenium - Java Code Geeks","og_description":"Interested to learn about Partial Link Text? Check our article explaining how to Find Elements With Link Text &amp; Partial Link Text In Selenium","og_url":"https:\/\/www.javacodegeeks.com\/2019\/06\/find-elements-link-text-partial-link-text-selenium.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2019-06-21T07:00:00+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/selenium-logo.jpg","type":"image\/jpeg"}],"author":"Sadhvi Singh","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Sadhvi Singh","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2019\/06\/find-elements-link-text-partial-link-text-selenium.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/06\/find-elements-link-text-partial-link-text-selenium.html"},"author":{"name":"Sadhvi Singh","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/c161d28b654426f5f53205d3e5741592"},"headline":"Find Elements With Link Text &amp; Partial Link Text In Selenium","datePublished":"2019-06-21T07:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/06\/find-elements-link-text-partial-link-text-selenium.html"},"wordCount":977,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/06\/find-elements-link-text-partial-link-text-selenium.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/selenium-logo.jpg","keywords":["Selenium"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2019\/06\/find-elements-link-text-partial-link-text-selenium.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2019\/06\/find-elements-link-text-partial-link-text-selenium.html","url":"https:\/\/www.javacodegeeks.com\/2019\/06\/find-elements-link-text-partial-link-text-selenium.html","name":"Find Elements With Link Text &amp; Partial Link Text In Selenium - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/06\/find-elements-link-text-partial-link-text-selenium.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/06\/find-elements-link-text-partial-link-text-selenium.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/selenium-logo.jpg","datePublished":"2019-06-21T07:00:00+00:00","description":"Interested to learn about Partial Link Text? Check our article explaining how to Find Elements With Link Text &amp; Partial Link Text In Selenium","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/06\/find-elements-link-text-partial-link-text-selenium.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2019\/06\/find-elements-link-text-partial-link-text-selenium.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2019\/06\/find-elements-link-text-partial-link-text-selenium.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/selenium-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/selenium-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2019\/06\/find-elements-link-text-partial-link-text-selenium.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Find Elements With Link Text &amp; Partial Link Text In Selenium"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/c161d28b654426f5f53205d3e5741592","name":"Sadhvi Singh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/bb8228ad0652dddd0649786b1b414bd85838ad14e20d439a8ee4aa51d416dba3?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/bb8228ad0652dddd0649786b1b414bd85838ad14e20d439a8ee4aa51d416dba3?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/bb8228ad0652dddd0649786b1b414bd85838ad14e20d439a8ee4aa51d416dba3?s=96&d=mm&r=g","caption":"Sadhvi Singh"},"description":"Sadhvi Singh is a QA Manager. In 7 years of her professional journey, she has worked on multiple domains and testing techniques like Automation testing, Database testing, API testing, Manual testing, and Security testing. With multiple tools exposure added to her experience, she has skilled herself further through her two major accolades at International level through ISTQB with foundation and advanced levels. She has a technical blog named as qavibes.blogspot.com where she caters to all the challenges offered in the day to day journey of the quality assurance aspirants. In her spare time, she also works as a technical trainer and mentor to many budding QA professionals.","sameAs":["https:\/\/www.lambdatest.com"],"url":"https:\/\/www.javacodegeeks.com\/author\/sadhvi-singh"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/93312","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/86855"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=93312"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/93312\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/231"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=93312"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=93312"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=93312"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}