This is a migrated thread and some comments may be shown as answers.

Clicking on an ASP.net button

7 Answers 91 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Zach
Top achievements
Rank 1
Zach asked on 30 Sep 2014, 01:57 PM
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">

7 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 03 Oct 2014, 02:54 AM
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
 
0
Zach
Top achievements
Rank 1
answered on 03 Oct 2014, 12:37 PM
Good idea, but that doesn't seem to work either.
0
Cody
Telerik team
answered on 03 Oct 2014, 08:51 PM
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
 
0
Zach
Top achievements
Rank 1
answered on 06 Oct 2014, 01:28 PM
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.
0
Cody
Telerik team
answered on 06 Oct 2014, 05:50 PM
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
 
0
Zach
Top achievements
Rank 1
answered on 06 Oct 2014, 07:05 PM
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.
0
Cody
Telerik team
answered on 06 Oct 2014, 11:27 PM
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
 
Tags
General Discussions
Asked by
Zach
Top achievements
Rank 1
Answers by
Cody
Telerik team
Zach
Top achievements
Rank 1
Share this question
or