I'm using Selenium for making some work: script should click at link followed by it's own address. For example, there is a method: clickAndWait. I have to pass it link title. But at my page this title changes, so I have to pa开发者_StackOverflow社区ss address to click at.
Could you help me with this?
p.s. I asked this question in selenium group, but still have no answer.
upd: For exampe, I have such html-code:
<a href="lalala.com">Some changeable title</a>
<a href="another.com">Some changeable title</a>
And selenium pseudocode:
ClickAndWait('Some changeable title')
But I have to click at site 'another.com', not 'lalala.com'. And link's title changes every time. Only link address is the same.
You could use one of the following locators:
//use XPath to match links with full href value
selenium.clickAndWait("//a[@href='another.com']");
//use XPath to match links with href values that start with string
selenium.clickAndWait("//a[starts-with(@href,'another.com')]"); //use partial href value
//use XPath to match links with href values that contain string
selenium.clickAndWait("//a[contains(@href,'another.com')]"); //use partial href value
精彩评论