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')]


Author: Pavandeep Puddupakkam on July 4, 2011
Category: XPath
Tags: ,
Google Webdriver Forum -The Online Community for Google Webdriver and Selenium RC Users and Professionals

Leave a Reply

Last articles