How to use link as a locator to find element in selenium?

0 votes
How can I use Link Text to find the element? I am new to selenium. Can you please help me with this?

Thank you in advance!
Dec 21, 2018 in Selenium by Jino
• 5,550 points
67 views

1 answer to this question.

0 votes

Hello @Jino, its amazing to explore ways on how to do things in different way. Using Link text is also another way for finding the method in which you can use the text in the link to click on that link.

So basically you will need to inspect the element and find the text associated and then simply create a reference to it.

Here is how to do this:

As you got the link text then use the following command to click on that :

driver.findElement(By.linkText("Advertising")).click();

Hope this helps.

answered Dec 21, 2018 by Nabarupa

Related Questions In Selenium

0 votes
1 answer

How to use JavaScript in selenium to click an Element?

Executing a click via JavaScript has some ...READ MORE

answered Apr 13, 2018 in Selenium by Shubham
• 13,110 points
9,791 views
+4 votes
1 answer
0 votes
1 answer

How to use name locator in selenium?

You can simply inspect the webpage and ...READ MORE

answered Dec 21, 2018 in Selenium by Nabarupa
14 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,050 points
258 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
626 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
254 views
0 votes
1 answer
0 votes
5 answers