Using regular expression in Selenium

Here is the xpath I want to use regular expression.
Code with out using regular expression:
Assert.IsTrue(selenium.IsElementPresent(“ctl00_5hh5_g5656_675gffg042f_tbSearch”));
Code using regular expression:
Assert.assertTrue(selenium.isElementPresent(“css=input[id$=’tbSearch’]”));

Alternative is to use contains in the xpath. Here is the example:
//input[contains(@id,’tbSearch’)]

Leave a Reply

Your email address will not be published. Required fields are marked *