"ExecuteCommandException" after executing click step

1 Answer 38 Views
Telerik Trainer
Ashish
Top achievements
Rank 1
Ashish asked on 18 Aug 2023, 08:16 AM | edited on 21 Aug 2023, 10:12 AM

Hello,

Product: Telerk TestStudio, Version: 2023.1.329.1

Browser: Chrome, Version: 116.0.5845.97 (Official Build) (64-bit)

In automation, I need to navigate from start page to end page to complete the contract creation process which requires entering/selecting info and navigate to next pages by clicking on "Next" button. In this process after clicking on Next button, next page takes more than 30 secs to load (~40-50 secs). And automation fails at that moment with exception. Exception attached.

For instance, there are 3 pages to complete the process. I am selecting few values on the 1st page and clicking on the Next button. It navigates to the 2nd page immediately. But when click Next button on 2nd page, it is taking more than 30 seconds before it goes to 3rd page.

NOTE: I am clicking "Next" button on 2nd page. As soon as I click on Next, it is trying to go to 3rd page. But it takes more than 30 secs on 2nd page before it navigates to 3rd page.

I tried different ways to to solve this problem to wait until the next page is displayed.

1. By updating ClientReadyTimeout to 180000 milliseconds

            int  oldValue = Manager.Settings.ClientReadyTimeout;
            Manager.Settings.ClientReadyTimeout = 180000;
            ActiveBrowser.Window.SetFocus();
            Pages.EntrustPartnerPortal27.ProductConfigSubmitSubmit.ScrollToVisible(ArtOfTest.WebAii.Core.ScrollToVisibleType.ElementTopAtWindowTop);
            Pages.EntrustPartnerPortal27.ProductConfigSubmitSubmit.MouseClick(ArtOfTest.WebAii.Core.MouseClickType.LeftClick, 0, 0, ArtOfTest.Common.OffsetReference.AbsoluteCenter);
            Manager.Settings.ClientReadyTimeout = oldValue;

2. By updating Client Ready Time to 120000 from Test Ribbon. Screen shot attached

Question: How can I resolve the issue so automation wait until next page is displayed after clicking on Next button?

Please provide the solution to overcome this issue.

Regards,

Ashish Thakkar

1 Answer, 1 is accepted

Sort by
0
Plamen Mitrev
Telerik team
answered on 21 Aug 2023, 01:06 PM

Hello Ashish,

I have already replied to you in the support ticket, but I will post the same two suggested in this public forum post. Someone else might have a similar scenario and could benefit from this information.

I talked with the developers on the team about this behavior and they suspect that the issue is related to a Refresh action that Test Studio does automatically after clicking the "Next" button. The WPF app takes some time to load, which causes the Refresh action to return an error. They suggested two possible solutions and I will list them below. You can try them separately and test if those work in your case.

  1. Disable the automatic refresh on click actions, before the click happens, and enable it back again after that. Here is an example code that I tried to make using your click action.
    Manager.ActiveApplication.MainWindow.Desktop.DisableAutoDomRefresh();
    System.Threading.Thread.Sleep(500);
    Pages.Window.Element.MouseClick(ArtOfTest.WebAii.Core.MouseClickType.LeftClick, 0, 0, ArtOfTest.Common.OffsetReference.AbsoluteCenter);
    System.Threading.Thread.Sleep(500);
    Manager.ActiveApplication.MainWindow.Desktop.EnableAutoDomRefresh(Manager.ActiveApplication.MainWindow); //you can replace the argument with the window that contains the element you need to click
  2. Or change the timeout on the click command. This will allow more time for the application to load the next window and content. After the click, you can again set the timeout to a lower value. Below is the code snippet to do that.
    Manager.Settings.ExecuteCommandTimeout = 60000; //60 seconds
                Pages.Window.Element.MouseClick(ArtOfTest.WebAii.Core.MouseClickType.LeftClick, 0, 0, ArtOfTest.Common.OffsetReference.AbsoluteCenter);
    
    Manager.Settings.ExecuteCommandTimeout = 15000; //15 seconds

I hope the above suggestions will work help you automate this scenario and similar situations.

Regards,
Plamen Mitrev
Progress Telerik

Virtual Classroom is the free self-paced technical training portal that gets you up to speed with Telerik and Kendo UI products including Telerik Test Studio! Check it out at https://learn.telerik.com/.
Tags
Telerik Trainer
Asked by
Ashish
Top achievements
Rank 1
Answers by
Plamen Mitrev
Telerik team
Share this question
or