Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get url from 'link' element in Selenium IDE

I want to get (and store to variable) url of one hyperlink (link) on the web page. Is it possible to get it in the Selenium IDE?

In my test I have to verify, if link exists, then store url from this link and use it later in the test.

Thanks.

like image 302
hano Avatar asked Apr 25 '13 17:04

hano


2 Answers

driver.findElement(By.xxx).getAttribute('href');
like image 92
buddy Avatar answered Oct 17 '22 12:10

buddy


Although this question was originally asked for the IDE, I just came here through Google searching for the same answer for Python.

The one above gives

AttributeError: 'WebElement' object has no attribute 'getAttribute'

because for Python it is

driver.find_element(By.xxx).get_attribute('href')
like image 9
Martin Thoma Avatar answered Oct 17 '22 13:10

Martin Thoma