Forum Discussion

dhopkins's avatar
dhopkins
New Contributor
9 years ago

My tests error when I use selections from a drop down list. Why is that?

When I record my tests I make selections from a couple drop down lists. When I run my test it always gets passed the first drop down selection but errors on the second drop down selection. Why is that

5 Replies

  • Marsha_R's avatar
    Marsha_R
    Icon for Champion Level 3 rankChampion Level 3

    You'll need to give us more specific information

     

    Are you using keyword tests or scripts?

    What happens when the test fails?  Is there an error message?  If so, what is it?  Or does it just skip the step?

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      Additional question: Is this an application where the selection from the one drop down list causes a form or page refresh? It's possible that this is a timing issue where the script is not recognizing the object of the second drop down because there is some sort of processing that is happening. Again, giving us the error information and a code snippet of some sort will be helpful.

  • dhopkins's avatar
    dhopkins
    New Contributor

    I think I'm using Keyword tests at least that's the folder my test is saved under.

     

    When the test fails it stops running and I get an error message saying "There was an attempt to perform an action on a zero-size window"

    • Marsha_R's avatar
      Marsha_R
      Icon for Champion Level 3 rankChampion Level 3

      Could we see your code, showing the drop down that works and the one that doesn't?

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        That definitely sounds like a timing issue. You're trying to interact with a component that sounds like it's in the middle of a refresh or resize process triggered by your selection on the first component.

        In this case, I don't think the standard "trick" of using custom time outs or WaitNNN methods will work. You may need to use some more deliberate checking, adding some sort of "while" loop to wait until the property of the drop down in question meets the requirements.  Something like

         

        while (MyObject.Width < 1) {
        Delay(1000);
        }
        

         

        It's kind of rough and dirty... better code would add an escape clause to kill out of the loop if a counter increases beyond a certain amount. But, essentially, after you execute your first drop down, you need to wait a period of time before you attempt to interact with your second one.  There are quite a few ways to implement this, mine is just one example.