How to locate an element by Xpath with its dynamic title

Example: I have two images
ImageHTMLCode
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’)][1]

Validating the text from a text box using Selenium RC

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”.
selenium.getValue(“//input[@id=’qu’]”)

If you found this solution helpful or have something extra to add, feel free to share it here by commenting below.

Using Xpath when you have new line text

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.

User-agent: *
Disallow: /clickthrough.html
Disallow: /details.html
Disallow: /post-sendtofriend.html

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

try
{
selenium.getText("//test[normalize-space()]").Equals("pass the string here");
}
catch(Exception)
{
}