How to do click_element/click_link when I don't have an id

Asked by Ovidiu Donciu on 2012-07-20

I'm trying to click on a text link that is on a page. It is like a menu link.
The HTML code for it:
<li><a href="http://maps.skobbler.com/">Maps</a><span class="beta-tag">beta<span></span></span></li>

What I'm currently doing is using click_element and click_link but can't make it to work because it can't find the element.

Any suggestion?

thanks

Question information

Language:
English Edit question
Status:
Answered
For:
selenium-simple-test Edit question
Assignee:
No assignee Edit question
Last query:
2012-07-20
Last reply:
2012-07-23
Kate Mueller (kmueller) said : #1

Whenever you don't have the ID for an element, use a get_element to find it. For example, here you'd use click_element or click_link with a nested get_element in it:

click_element(get_element(tag='a', href='http://maps.skobbler.com', text='Maps'))

~K

Can you help with this problem?

Provide an answer of your own, or ask Ovidiu Donciu for more information if necessary.

To post a message you must log in.