Using regexpi in selenium.isTextPresent()

Share on Facebook0Share on LinkedIn0Share on Google+0Tweet about this on Twitter0Email this to someoneDigg this

Here is an example where you can use regexpi in selenium.isTextPresent(). You can use regexpi when you are checking for the text but are not worried about the case-sensitivity if the text.

Say I am looking for the text “This is” and the text on the webpage is “This is”; if you use selenium.isTextPresent(“This is”) your script will fail. To verify this you can use selenium.IsTextPresent(“regexpi:This is”)

Assert.IsTrue(selenium.IsTextPresent("regexpi:This is"));
catch (AssertionException e)

The regexp function is case sensitive in matching regular expressions to a string, and regexpi is case insensitive.

5 thoughts on “Using regexpi in selenium.isTextPresent()

  1. luciano says:

    Assert.IsTrue(Regex.IsMatch(selenium.GetText(webTouHeading), Control.Product +" example string", RegexOptions.IgnoreCase));

  2. Giribabu says:

    Displaying following error “line 18: ExecutionResult: Object reference not set to an instance of an object.” when i use following code “selenium.IsTextPresent(“regexpi:Prices Saved”

  3. Ravi Teja says:

    Hi , I am having similar requirement , i need to select a checkbox , i will get the checkbox name dynamically during the program execution. I need to select the checkbox ignoring case sensitivity , i have

    tried“css=td[class=’dxeListBoxItem dxeT’]:contains(“regexpi:”+str+””)”);

    but it is highlighting as error in eclipse .
    Please help me in solving this.

    ThankS & Regards
    Ravi Teja P.

Leave a Reply

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