Clicking on an ASP.net button

8 posts, 0 answers
  1. Zach
    Zach avatar
    33 posts
    Member since:
    Sep 2014

    Posted 30 Sep 2014 Link to this post

    Hello there!

    I have been having difficulty clicking on this button for some reason. I just can't figure it out.
    I can get the button with  -    Element updateBtn = iFrame.Find.ById("btnUpdateResult"); The id makes that part easy enough.

    But clicking on it doesn't do anything! I've tried Actions.Click, as well as Actions.invokeEvent(updateBtn, ScriptEventType.OnClick), as well as OnSubmit.


    This is what the element looks like in the browser.
    <input name="btnUpdateResult" value="Update Result" id="btnUpdateResult" class="eqdax-resultPanel-updateButton" type="submit">

  2. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 02 Oct 2014 Link to this post

    Hello Zach,

    Try doing a mouse click:
    Element updateBtn = iFrame.Find.ById("btnUpdateResult");
    Manager.Desktop.Mouse.Click(MouseClickType.LeftClick, updateBtn.GetRectangle());


    Regards,
    Cody
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
  3. Zach
    Zach avatar
    33 posts
    Member since:
    Sep 2014

    Posted 03 Oct 2014 in reply to Cody Link to this post

    Good idea, but that doesn't seem to work either.
  4. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 03 Oct 2014 Link to this post

    Hello Zach,

    Anytime someone tells me that a mouse click did not work, my first suspicion is whether nor not the mouse cursor moved to the right location to perform the click. If you watch the test very carefully, do you see the mouse moving over to the correct button in the UI?

    If you are, I need a way I can see this problem and study it. Can I get direct access to this problem application so I can diagnose what's going on?

    Regards,
    Cody
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
  5. Zach
    Zach avatar
    33 posts
    Member since:
    Sep 2014

    Posted 06 Oct 2014 in reply to Cody Link to this post

    Actually, the Desktop.Mouse.Click does work. It didn't work the first time I tested because I normally move my console window after running my program and clicking off the browser window seems to cause telerik to "Lose focus" causing the click to not work. If I run the program and don't touch anything it works most of the time, seems like 1/4 runs it won't work for some reason.
  6. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 06 Oct 2014 Link to this post

    Hello Zach,

    It is true the browser window must have input focus, must be top most, and you cannot be moving the mouse while the test runs. That's the drawback to a test that requires using the mouse.

    Failing 25% of the time is still not expected however. The next time it fails please go to Step Failure Details, find and click Export then send me the generated .zip file for analysis please.

    Regards,
    Cody
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
  7. Zach
    Zach avatar
    33 posts
    Member since:
    Sep 2014

    Posted 06 Oct 2014 in reply to Cody Link to this post

    Unfortunately I am simply using the testing framework and not test studio, so I cannot access that page.

    A bit more information on the bug: when it occurs instead of mousing over the element, the mouse moves to the top left corner of the page.
  8. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 06 Oct 2014 Link to this post

    Hello Zach,

    That sounds like adding a simple delay:

    System.Threading.Thread.Sleep(n);

    Might help just before the mouse click. Can you share with me the full code? Also can you capture a Jing video showing it working properly and it also failing (i.e. two separate videos)? That would help me understand what's going one and maybe why it's intermittently failing.

    Regards,
    Cody
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
Back to Top