reg-ex verification doesn't work correctly (inside an if-else condition))

7 posts, 0 answers
  1. Daniele Bruno
    Daniele Bruno avatar
    22 posts
    Member since:
    Apr 2009

    Posted 26 Jan Link to this post

    hello again,

    today I have to test if a textarea of an application has been populated with information and, if so, give some feedback to the tester.

    the point is:

    I need to build a verification which checks if the value of a textarea is still the empty string ("") or if it has been written upon.

    I tried many ways looking in the documentation, in examples and so on, and I have come up trying to use a simple regular expression to do this check. I've built an if-else condition which bears a verification that works somewhat like this (see screenshot):

    "if this element's text-attribute's value is != ".+" (which should mean "one or more any character" in regex), prompt a windows that says so, if not, prompt another window that says the opposite"

    if I run this test on two elements, one with the desired textarea full of text and the other empty, in both cases my verification seems to give positive feedback.

    I am missing something, or maybe the regex is not validated.

    coul you give me a hand on this?

    thanks in advance to anyone who could teach me how this works.

  2. Daniele Bruno
    Daniele Bruno avatar
    22 posts
    Member since:
    Apr 2009

    Posted 26 Jan in reply to Daniele Bruno Link to this post

    actually, the screen is wrong:

    I was trying the regex ".+" solution, but also the exact: "" one, so that was a mistake.

    the things I've tried are in the following image

  3. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 29 Jan Link to this post

    Hello Daniele,

    I guess what you are trying to complete is only possible using a coded solution. However without an access to the actual section of the application we cannot assist you further.

    Do you think you can provide us with access so we can give it a try?

    Regards,
    Ivaylo
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  4. Daniele Bruno
    Daniele Bruno avatar
    22 posts
    Member since:
    Apr 2009

    Posted 05 Feb in reply to Ivaylo Link to this post

    hello there,

    I wish I could, but since we are currently testing a product in development I am not allowed to show the application or grant external access to our test machines.

    but maybe I could provide you with sufficient infos about the DOM structure around that element to give you the right insight to help me out, I'll try and give you the details as soon as I can.

    fro now, thank you very miuch

  5. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 09 Feb Link to this post

    Hi,

    You are most welcome.

    Whenever you provide sufficient details we can continue working on this case. I am leaving this case in stand by awaiting your reply.

    Regards,
    Ivaylo
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  6. Daniele Bruno
    Daniele Bruno avatar
    22 posts
    Member since:
    Apr 2009

    Posted 15 Feb Link to this post

    hello again Ivalyo,

    so let me try to explain my situation better with some more information.

    I am building a test case that needs in a certain step to check if a form has text in it or not.

    In the web application I am testing there's a process that scans an image for text (an optical character recognition process); if this process finds characters, it writes them in the form in question, if it doesn't, it stays empty.

    this form is accessed by the user displaying infos on a given document and it is a simple textarea tag, I am attaching a screenshot in which it shows a document which has a form WITH text (not empty).

    the problem is that inside the tag itself in the code of the page there is NO TEXT, the page code (got locating in the DOM the given element of the page) is the one that follows:

    <div class="popupBox">
      <div class="popupVoci" style="">Testo OCR:</div>
      <div>
        <textarea rows="12" name="" id="infoFileElementTextarea_ocr_text" class="infoFileElementTextarea" readonly="true" value="" style="height:auto;">
        </textarea>
      </div>
    </div>

    as you can see from this pasted HTML and from the screenshot the tag which I am trying to check is th one called "infoFileElementTextarea_ocr_text"

    up until now, every verification I tried inside Test Studio went wrong, indifferently from the logic implemented, I could never actively verify if the element has text in it or not, since this tag stays empty in any given case.

    I hope i shed some light on this matter

    until next time

  7. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 17 Feb Link to this post

    Hello Daniele,

    Thank you for providing additional information and the code snippet. I can see that the value is empty. Is that from your browser or this is pulled out from Test Studio's DOM tree?

    Please note that if this is a result from the browser the behavior you are experiencing is quite expected.

    Looking forward to hearing from you. 

    Regards,
    Ivaylo
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
Back to Top