I'm using Selenium's IDE in FireFox to do some testing, and I want Selenium to click the second link (Text2). Any idea how I do that? Unfortunately I don't have access to the HTML and can't modify it. The record function doesn't seem to register the click.
The code is attached below. Thanks in advance!
<div class="class1">
<div class="class2">
<span class="class3"><a href="#" onclick="fn1();">Text1</a></span>
</div>
</div>
<div class="class1">
<div class="class2">
<span class="class3"><a href="#" onclick="fn2();">Text2</a></span>
</div>
</div>
You Can Try
//a[contains(text(),'text2')] OR //span/a[contains(text(),'text2')]
Looking for same or anything else?
Please disregard this post. Selenium is ignoring the "Value" field and simply selecting the 1st occurrence of span.class3. Sorry about this. I should have tested more before posting.
Original post: I have a similar webpage, and I was able to use the following Selenium IDE command: command: clickAndWait target: css=span.class3 value: Text1
来源:https://stackoverflow.com/questions/11311100/selenium-click-on-link