User.Click() not clicking in Silverlight application

13 posts, 0 answers
  1. Tim
    Tim avatar
    3 posts
    Member since:
    Sep 2013

    Posted 01 Oct 2013 Link to this post

    Hello,
    I've been cruising the forum for some time now looking for a solution to the problem I'm facing. I see many threads similar to the issue I'm seeing but I have yet to find a solution in those threads that solve the problem.

    I've exported the tests to run independently from Test Studio using nunit in the console. I've gotten the test to kick off and run filling out a login form up to the point of clicking the Login button. I can see the button, verify its clickable, highlight it, etc. However, when I go to click it using User.Click(), nothing happens. I've enabled annotations and it shows the click action occurring, yet the button is not clicked

    I've tried clicking it through FindName:
    this.App.FindName<Button>("PART_LoginButton").User.Click();

    I've tried through the exported method from Test Studio:
    Pages.<PageName>.SilverlightApp.PARTLoginButtonButton.User.Click();
     Neither of those two methods work. In addition, I've also ensured that settings.Web.EnableSilverlight = true, tried refreshing the dom tree, clicking the silverlight app bounds to ensure that its selected, double clicking (single clicking twice), refreshing the visual trees, and even sleeping before clicking the button to ensure no AJAX type code is affecting the button.

    Here is the source code of the button itself:
    <button Name="PART_LoginButton" AutomationId="PART_LoginButton" Uid="65158171">
      <grid Uid="34157240">
        <border Name="Background" Uid="57177053">
          <textblock Name="textBlock" AutomationId="textBlock" Uid="44831437">Login</textblock>
        </border>
      </grid>
    </button>

    Any assistance to get this code clicking that button would be greatly appreciated!

    Thank you,
    Tim Harrison

    Edit: Added button source code.
  2. Tim
    Tim avatar
    3 posts
    Member since:
    Sep 2013

    Posted 03 Oct 2013 Link to this post

    Anyone have some time to look at this? I've been stuck on this for weeks. Someone at least give me a glimmer of hope.
  3. Daniel
    Daniel avatar
    13 posts
    Member since:
    Aug 2013

    Posted 03 Oct 2013 Link to this post

    Not an expert in the realm of Silverlight applications (never automated or coded), but give this a shot if you haven't:

    (format code block not working for me at the moment, plain text coding incoming!)

    Pages.Cognistix.SilverlightApp.PARTLoginButtonButton.User.Click(ArtOfTest.WebAii.Core.MouseClickType.LeftClick);


    Invoking the MouseClickType.LeftClick seemed to do the trick for me.  May need to use whole ArtOfTest.WebAii.Core.MouseClickType.LeftClick.

    *EDIT*

    Identifying the element entirely through code has worked for me as well.:

     

    SilverlightApp app = ActiveBrowser.SilverlightApps()[0];

     app.Find.ByName<Button>("PART_LoginButton").User.Click(MouseClickType.LeftClick);

     

  4. Tim
    Tim avatar
    3 posts
    Member since:
    Sep 2013

    Posted 03 Oct 2013 Link to this post

    Thanks Daniel for your reply.

    I remember trying something similar from the direct export from Test Studio. I tried it again just now with no change in the behavior. It still acts like it clicks, but doesn't actually click.

    Another thing I feel I should note is that the actual mouse cursor does not move to that location. I remember that happened when I executed the tests through Test Studio. Is that perhaps a hint as to what is wrong? Or is it the case that the cursor does not actually need to move in order for the click to actually happen (much like how Selenium works)?

    So to add to the list of things I've tried:
    Daniel's suggestion:
    Pages.<PageName>.SilverlightApp.PARTLoginButtonButton.User.Click(ArtOfTest.WebAii.Core.MouseClickType.LeftClick);
    As well as the direct export from Test Studio:
    Pages.<PageName>.SilverlightApp.PARTLoginButtonButton.User.Click(ArtOfTest.WebAii.Core.MouseClickType.LeftClick, 0, 0, ArtOfTest.Common.OffsetReference.AbsoluteCenter, ArtOfTest.Common.ActionPointUnitType.Percentage);
  5. Daniel
    Daniel avatar
    13 posts
    Member since:
    Aug 2013

    Posted 04 Oct 2013 Link to this post

    I'm at a loss as to why it would not be functioning.  The only difference I can note at this point is I am running the test from Test Studio (or Visual Studio), instead of NUnit. 

    I've tried repeated other methods of setting focus, clicking, not specifying clicktype, etc...and they have all worked.

    I'll see if I can download and try NUnit today to reproduce the behavior you are experiencing.
  6. Boyan Boev
    Admin
    Boyan Boev avatar
    1039 posts

    Posted 07 Oct 2013 Link to this post

    Hi Tim,

    Thank you for contacting us.

    Unfortunately I was not able to reproduce this behavior against a public application.

    Since this is a specific application issue please:

    1. Please provide us with a copy of your test and if it is possible grant us access to your application so we can reproduce the issue on our end and give you a solution. 

    2. If direct access is not possible, capture a Fiddler trace and attach it to this support ticket in a zip file. If you are unfamiliar with how to do so, this link will provide you with step-by-step instructions for download and use. Please make sure to enable 'Decrypt HTTPS traffic' and 'Store binaries' options (see attached image) before starting capture.

    3. A Jing video demonstrating the issue may also help us to better understand what is happening.

    Hope to hear from you soon.

     

    Regards,
    Boyan Boev
    Telerik
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  7. Andrey Cherepakha
    Andrey Cherepakha avatar
    21 posts
    Member since:
    Apr 2010

    Posted 31 Oct 2013 Link to this post

    Hello!

    I faced with the same problem on Win7 Professional SP1 64bit. 

    Action: Button.User.Click();
    Expected result: a button is clicked;
    Actual result: a button is not clicked.

    The same application works fine on WinXP SP3

    I use WebAii 2011.2.1413.0, but also tried it with the latest version 2013.1.911.0

    May 64bit cause the problem? Does WebAii support Win7 64bit?

    Thanks
  8. Boyan Boev
    Admin
    Boyan Boev avatar
    1039 posts

    Posted 04 Nov 2013 Link to this post

    Hello Andrey,

    Thank you for contacting us.

    As I said to Tim, we need to reproduce the issue on our end so we can debug it.

    1. Please provide us with a copy of your test and if it is possible grant us access to your application so we can reproduce the issue on our end and give you a solution. 

    2. If direct access is not possible, capture a Fiddler trace and attach it to this support ticket in a zip file. If you are unfamiliar with how to do so, this link will provide you with step-by-step instructions for download and use. Please make sure to enable 'Decrypt HTTPS traffic' and 'Store binaries' options (see attached image) before starting capture.

    3. A Jing video demonstrating the issue may also help us to better understand what is happening.

    4. Send us the trace log or any other error output which can helps us diagnose the problem.

    Yes, WebAii supports Win 7 64 bit, that should not be the reason of the problem.

    Hope to hear from you soon.

    Regards,
    Boyan Boev
    Telerik
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  9. Stephen
    Stephen avatar
    23 posts
    Member since:
    Jan 2008

    Posted 07 Nov 2013 Link to this post

    Hi there,

    Is there any explanation for this yet?

    The mouse click does not work for me either under a specific context.

    1) I created a test application in VS 2012 and the mouse click works fine.
    2) I added the Telerik Testing Framework into an existing Silverlight app and the mouse click works fine.
    3) I added the Telerik Testing Framework into a an existing WPF application which is testing the Silverlight app above and the mouse click does not work. The mouse cursor does not move to the button, it stays where it is. It looks like the security context of the browser initiated by the WPF application is different than the app 1 and 2 above.

    I've been trying to figure out what is going on without progress.

    Many thanks

  10. Andrey Cherepakha
    Andrey Cherepakha avatar
    21 posts
    Member since:
    Apr 2010

    Posted 08 Nov 2013 Link to this post

    Stephen wrote : "The mouse click does not work for me either under a specific context." The same is for me.

    I created a test application from scratch in VS2012 using WebAii 2013.1.911.0 and the mouse click works fine.

    But no luck with my main test application, which a bit complicated. I am going to investigate it deeply and get back with a result.
  11. Boyan Boev
    Admin
    Boyan Boev avatar
    1039 posts

    Posted 08 Nov 2013 Link to this post

    Hi,

    @Andrey, please take your time and update this thread accordingly. 

    @Stephen, as I wrote to Andrey, we need to reproduce this locally so we can debug the issue deeper. 

    Please check out my post to him.

    Hope to hear from you soon.

    Regards,
    Boyan Boev
    Telerik
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  12. Andrey Cherepakha
    Andrey Cherepakha avatar
    21 posts
    Member since:
    Apr 2010

    Posted 21 Nov 2013 Link to this post

    After long time investigation I found out that the cause of the issue is NUnit (to be more precise  - which Nunit runner is used to run tests)

    Here is my configuration:
    Windows 7 64 bit
    WebAii 2011.2.1413.0
    NUnit 2.5.9.10348

    Issue: User.Click() not clicking in Silverlight application if test is defined with TestFixure (NUnit). Everything works fine if test is defined with TestMethod (MS Test).

    Solution to make NUnit work:
    1) Visual Studio - Solution Explorer - Project Properties - Build - Platform target   change from Any CPU to x86
    2) run tests with nunit-x86.exe

    To make NUnit tests run from Visual Studio with ReSharper:
    1) Visual Studio - ReSharper - Options - Tools - Unit Testing - nUnit - Specified NUnit installation - define path to the NUnit folder with nunit-x86.exe
  13. Boyan Boev
    Admin
    Boyan Boev avatar
    1039 posts

    Posted 22 Nov 2013 Link to this post

    Hi Andrey,

    Thank you very much for sharing this information.

    I have update your Telerik points.

    We appreciate your feedback, which we rely on to improve our product. 

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