cancel
Showing results for 
Search instead for 
Did you mean: 

page is taking too much time after click on Confirm dialoxbox

Frequent Contributor

page is taking too much time after click on Confirm dialoxbox

Hello,

Here i am trying to handle a confirm dialogbox when i manually click on "OK" button page is not taking too much time to load but when i execute it with my script it's taking too much time to load the page.

Also i had tried all kind of Action methods like(Click, ClickM, ClickButton, DblClick)

Please check the below code

 

Set Ok_dialogbox = page.FindChild("ObjectType", "Confirm", 5000)

If (Ok_dialogbox.Exists) Then

     page.Confirm.Button("OK").Click

     Log.Message("Message text: " + page.Confirm.Message)

End IF

3 REPLIES 3
Community Leader

Re: page is taking too much time after click on Confirm dialoxbox

In my opininion you need to wait a little longer with the click action.

 

If you use the .Exist method without any condition TestComplete waits only certain portion of time and then executiing next line of your script.

 

Try to use this function:

 

function waitForObj(obj, counter) {
  var counter = counter || 60;
  for (var i = 1; i <= counter; i++) {
      if (obj.Exists == false) {
          aqUtils.Delay(1000);
      } else {
          return true;
          //break; // or use just break break 
      }
  }
}

I know that this is JS but the code is simple so you can change it to VB if you want.

Highlighted
Community Hero

Re: page is taking too much time after click on Confirm dialoxbox

Hi,

 

You did not provide too much information about what is taking too much time, what is your definition of 'page load' and what do you get in a test log, but I see some potential problem in your code:

>     page.Confirm.Button("OK").Click

>     Log.Message("Message text: " + page.Confirm.Message)

Technically, after you close Confirm dialog via .Click(), Confirm dialog (presumably) is closed and disposed of. And on the next line you are trying to get some property (Message) of potentially non-existing object.

What will happen next depends on a lot of factors:

-- If the dialog is not disposed of you should get the value of the Message property without delay;

-- If test code executes faster that the dialog is destroyed, then also I would not expect execution delays;

-- If the dialog is already disposed of by the moment of getting the value of the Message property, TestComplete will start to search for the dialog a-new and this obviously will slow down execution speed. The results depends on the search result - if some other Confirm dialog is found, then the value of its Message property will be posted to test log. If search fails, you should get a warning/error in test log stating that the sought for object was not found.

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Community Manager

Re: page is taking too much time after click on Confirm dialoxbox

Hi @kaiiii,

 

Do the suggestions given here help you resolve the issue? Please mark the reply which you decided to follow as a solution.

 

 

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
New Here?
Join us and watch the welcome video:
Watch the new Interview