Forum Discussion

whuang's avatar
whuang
Regular Contributor
6 years ago
Solved

Why the find method cannot see the text on the page?

Hi everyone,

 

I have this vbscript here looking some text on a webpage, it keeps telling me that the property value was not found, but I can see the text I want to verify is right there on the page. Can anyone help me why it cannot see it?

Thanks

  • You can find using partial text.  You will just need to use regex in you propertu values e.g.

     

    Page.Find("contentText","regexp:(Your password has been)",100).Exists
  • Hi,

     

    > it can't find partialy text?

    You can use wildcards. E.g. :

    Page.Find("contentText","Your password has been*",100).

     

    > I find out Edge was running in process, but I didn't launch it at all. [...] Any idea why is that?

    This is because in order to improve start time (and, possibly, do some other things that they think they must do disregarding your opinion;) ) a lot of overly smart modern applications continue to run in the background after you explicitly close them. :)

    Solution: https://answers.microsoft.com/en-us/edge/forum/all/why-is-edge-running-when-i-have-not-opened-it/76c2606c-329c-4ebf-b755-a2bd0107b1ef

     

     

9 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    Is this the only browser process that runs in your system?

    Note, that as browser name and page address are wildcarded in your code, TestComplete will pick-up any browser that it finds first, get a reference to any page opened in this browser and try to search within this page.

    So if you have more than one browser, the chances are high that some other but assumed browser and page are used for search.

     

    • whuang's avatar
      whuang
      Regular Contributor

      Hi Alex,

       

      Yes, Chrome was the only browser that was running, after I updated my script, it now can find the text but with warning "Ambiguous browser recognition". I find out Edge was running in process, but I didn't launch it at all. I will have to kill the Edge from process in order to pass the test. Any idea why is that?

  • Your find string in the find method doesn't have the exact same text as the contentText.  the one has a trailing "."

     

    Either add the "." to your find method or remove the "." from your page.  I'm guessing it's the latter.  If you really don't know if the "." will be there or not, try finding the leading string with Regex

    • whuang's avatar
      whuang
      Regular Contributor

      Thanks. After I added the "." to my script, it can find the text now.  But then I am wondering it can't find partialy text?

      • RUDOLF_BOTHMA's avatar
        RUDOLF_BOTHMA
        Community Hero

        You can find using partial text.  You will just need to use regex in you propertu values e.g.

         

        Page.Find("contentText","regexp:(Your password has been)",100).Exists