...

/

Getting Link Attributes and Tabs Switching

Getting Link Attributes and Tabs Switching

Further explore hyperlinks in this lesson by learning how to get data attributes of a link and how to open it in a new window.

Getting link data attributes

Selenium provides functionality not only for driving the link, but also for driving its attributes. To do this, we first need to identify the link. Once it is identified, we can get to its other attributes (this generally applies to most of the web controls). The following script shows how to get data attributes of a link:

driver.findElement(By.linkText("Recommend Selenium")).getAttribute("href").then(  
 
...