<Street>York St <br/> <br/>Sydney<Street>
Xpath to check if the Street tag has the text “Sydney”.
Example: I have two images
some_date1 and some_date2 are generated dynamically.
How to locate them using CSS locator ?
click css=img[title*=’since’] : will not work because it won’t
make difference between the two images.
Here is the solution:
If you want to click on the first try this : //IMG[contains(@title,’Critical since’)]
Here is the html code input id=”qu” and the text in the text input box is Selenium Wiki.
To validate the text from a text box using Selenium RC you will have to use the Selenium command selenium.getValue(). This will get the value in the location input id=”qu”.
If you found this solution helpful or have something extra to add, feel free to share it here by commenting below.
Here is an example where there are new lines and have to validate if the exact text is displayed in the correct order using xpath.
Use normalize-space(), which will throw away the leading and trailing whitespace characters (and condense repeating spaces in the middle of the text into a single space), so that you can compare the normalized text() and use to filter in a predicate.
Here is the xpath code to validate the above text
selenium.getText("//test[normalize-space()]").Equals("pass the string here");