Can't extract url value from ahref to variable


This is my HTML

<td><span><a href="">MyText</a><br></span></td>

I can extract “MyText” using:

${mytext}    get text    xpath://div/table/tbody/tr[1]/td[7]/span/a

but I cannot extract the url from this table cell, I have tried:

${myurl}    get value    xpath://div/table/tbody/tr[1]/td[7]/span/a


${myurl}    get element attribute    xpath://div/table/tbody/tr[1]/td[7]/span/a

this is the full xpath to the ahref using chrome dev tools:


any ideas what I am doing wrong thank you.

Maybe there’s some bit missing in this code snippet - I don’t see the attribute argument there.

Please give an example I am confused.

For example:

${attribute}=    Get Element Attribute    css=a    href
1 Like

Thank you this was what I needed, you are a genius, I wish I was better at coding and I didn’t have to waste your time.

I like helping others - I don’t see it as a waste of time. :smiley:

Coding, like all other things, takes some practice. You’ll get better at it the more you do it. Good luck!

1 Like