Search code examples
seleniumtextwildcardselenium-ideverify

verifyText using *text* instead of verifyTextPresent (deprecated)


I'm kind of new to selenium IDE and automated test and I don't know much about programming languages. I have a question concerning verifyText command as verifyTextPresent is deprecated. If I put the target word/text in * * will it work as if I was using verifyTextPresent? Could waitForText work?

I am trying to verify that the search function of a website is working as expected. I search the word "client" and I want to verify that the word is present in the results.

    clickAndWait   css=div.cf-tooltip-text   
    type           id=edit-global-search             client
    clickAndWait   id=edit-submit-global-search
    verifyText     id=content-column                 *client*

This works, but in the Log I can not understand what it really does. Also if I try the word on its own "client" I get an error which I understand because it compares it to the text of the whole column. I also tried to put an irrelevant word between asterisks such as youwillnotfindthetext (just to make sure that everything between asterisks will pass the test) and there I had an error too.

So it seems to be working somehow but I want to ask some of you expert guys.

Thanks


Solution

  • If you put a * in starting and ending means it will look for the inner text containing in the specific element. If a text is present as you given in the script it will return a pass. If the text u specified in the script is not present, it will throw an error. That's what happens when you put youwillnotfindthetext in between the *. Check this link Selenium: test if element contains some text