0

I'm trying to perform very simple automated test. I created XPath selector in a FirePath, here it is:

//a[@href='http://i.yandex.ru/'][span[contains(.,'[email protected]')]]

But Selenium-RC can't locate this element. Code is:

final String StrEmailToTest = "[email protected]";
String linkEmailSelector = "//a[@href='http://i.yandex.ru/'][span[contains(.,'"+ StrEmailToTest + "')]]";
selenium.isElementPresent(linkEmailSelector);

and it returns "false"

Could you tell me, what am I doing wrong?

UPD. I've uploaded the *.maft - file here: http://depositfiles.com/files/lhcdh2wtl Don't be afraid, there are some russian characters on the screen.

2
  • Without the HTML snippet, we're not going to be able to help you with this. Commented Dec 23, 2011 at 23:42
  • i've updated the topic with the HTML-example Commented Dec 26, 2011 at 8:22

2 Answers 2

1

Shouldn't your XPath be:

"//a[@href='http://i.yandex.ru/']/span[contains(.,'"+ StrEmailToTest + "')]";
Sign up to request clarification or add additional context in comments.

1 Comment

I used your XPath, but the same problem occured: FirePath says 'yes', Selenium says 'No'....
0

My guess is that selenium is looking for the element even before it's loaded. Is it a dynamically loaded/generated element? If so, use waitForElementPresent(). If not, try changing the method of element identification - use id or name and then try to execute it. To make sure your xpath is correct, in the selenium IDE/plugin for firefox, type the path of the element(issue some random command for command field) and click on "Find Element". If it finds, then selenium has no problem finding it, given that the page/element is loaded or generated. If not, you will have to ask Selenium to wait till the element is loaded.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.