how to locate link having href as java script function in selenium using java lang
need to locate libraries and color colorway
I am new to selenium. please suggest how to locate links highlighted in image using selenium.
I have tried
linktext() but not it is not working.
This is the HTML :
linkText works for text between the anchor tags.
I can see partial linkText which is Libraries
UPDATE 1 :
You can try this xpath also :
code would be :
UPDATE 2 :
As OP has mentioned that there is a frameset available and desired element is present in that.
You will have to switch the focus of your driver to interact with your desired element.for that you can use this code :
Selenium Click Link By href Value, In Selenium WebDriver, there are a number of ways we can interact QA · Automation · Selenium · API Testing · Java · Python · Agile We can also click links by linkText or partialLinkText . the above function will always click the first link containing the word profile. 2020 DevQA.io About Contact Privacy. How to get page source as it is in browser using selenium. 1 day ago How to capture the status change of a process in selenium, after the process is kickstarted(Run) 4 days ago Exception in thread "main" java.lang.IllegalStateException 5 days ago
You can use Xpath :
You can use this xpath selector for selecting these three highlighted elements :
"//a[contains(.,'Libraries')] | //a[contains(.,'Calendar')] | //a[contains(.,'Color')]"
It will give a list of 3 elements
It will work for you. Please do let me know if any issue occurs.
The logic is that you have to use "OR" condition if you want to get these elements.
Check for iframe existence as suggested by other answers and than try to get elements using this selector
Complete Guide For Using XPath In Selenium With Examples , Locating dynamic elements have always been the pain area while you Writing Dynamic XPath in Selenium by different ways: and <a target="_blank" href="https://www.lambdatest.com/privacy">Privacy current node with tagname input having attribute as name with value import java.util.concurrent. What is jQuery and how to use it, how to run jQuery code in Selenium WebDriver are explained in this post. What is jQuery: jQuery is just a Java Script Library, it simplifies the task with less code.