get all links, where links does not have id

526 views
Skip to first unread message

Rathore

unread,
Sep 5, 2013, 4:47:33 PM9/5/13
to robotframe...@googlegroups.com
Hi All,
 
I am new to robotframework trying to get all availble links from one of page, "get all links" function does not works for me as it requires ID, in my case links are not having attribute ID.  Available attributes for links are class, href and target.
 
Once I will get the collection of links, then I need to click on every link and then verify the appeared page.
 
Thanks,
Rathore

Rathore

unread,
Sep 6, 2013, 12:23:39 PM9/6/13
to robotframe...@googlegroups.com
Still looking some one help around this, I got one post which says use  driver.find_elements_by_partial_link_text('##'), which will return all available link on that page.

but It says to me "Selenium2Library' object has no attribute 'find_elements_by_partial_link_text'.

also, when I look into keyword list do not see any similar key in robotframework.

could anyone let me know how to proceed, it is just stuck sitution for me.

Thanks again,
Rathore

Kevin O.

unread,
Sep 6, 2013, 2:11:15 PM9/6/13
to robotframe...@googlegroups.com
If you want to iterate over all the links, try code like this
    Open Browser    http://www.google.com/
    ${count}=    Get Matching Xpath Count    //a
    : FOR    ${i}    IN RANGE    1    ${count} + 1
    \    ${href}=    Get Element Attribute    xpath=(//a)[${i}]@href

Its hard to believe that testing like this is still useful since so much happens on elements besides anchors.

Rathore

unread,
Sep 6, 2013, 6:57:10 PM9/6/13
to robotframe...@googlegroups.com
Hi Kevin,

Thanks for your reply, it worked for me!

Regards,
Rathore
Reply all
Reply to author
Forward
0 new messages