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

[Solved] Javascript settimeout problem while crawling !

3 Answers 46 Views
Telerik Testing Framework
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ozz Karat
Top achievements
Rank 1
Ozz Karat asked on 05 Mar 2010, 03:23 PM
Web Aii could make synchronized Click because of "settimeout" function
for example  :

<input id='checkbox1' type="checkbox" onclick="javsacript:setTimeout(getIt)" /> // getIt makes Ajax Request
browser.Actions.Click(browser.Find.ById("checkbox1")); // This command not synchronized because of settimeout

How can i solve this problem?

* Is there any patch for disabling settimeout converting it to immediate function calling.
* Any other tactics to solve this problem ..

Thx..
 PR: wait...  I: wait...  L: wait...  LD: wait...  I: wait... wait...  Rank: wait...  Traffic: wait...  Price: wait...  C: wait...

3 Answers, 1 is accepted

Sort by
0
Missing User
answered on 05 Mar 2010, 10:23 PM
Hi Ozz,

I'm not entirely sure I understand what you mean by the command not being synchronized. So just to verify, is the checkbox being clicked and the Ajax Request happening?

From what I understand, if the Ajax Request is still processing and the test code is moving to quickly, then you can add a Thread.Sleep(someInt) to wait for the Ajax Request to finish.

If there are any controls on the page that are refreshed by the Ajax Request, you can either do an ActiveBrowser.RefreshDomTree() or just refresh an individual control wrapper like HtmlControl.Refresh()

If the checkbox is not being clicked or the Ajax Request is not happening, you can try the following:

HtmlInputCheckBox b = browser.Find.ById<HtmlInputCheckBox>("checkbox1"));
b.Check(true,true); //Sets the checked state and invokes onClick

Hope that helps,
Nelson Sin
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Ozz Karat
Top achievements
Rank 1
answered on 08 Mar 2010, 10:29 AM
Scenario:

- An User clicks checkbox or selects item from dropdownlist or click button .
- Browser makes Ajax Call and update Content
- I can access new content  by (browser.Find...)

I don't want to use indefinite seconds for waiting or WaitForElement trick.
Why we could not get BrowserReady event ..

I need function like ,

browser.Actions.ClickAndWaitTillBrowserReady 

or for my question

browser.Actions.ClickAndWaitTillBrowserReady_AlthoughThereIsJavascriptSetTimeoutFunction
:)
Thx ,BestRegards




0
Missing User
answered on 10 Mar 2010, 12:12 AM
Hi again Ozz,

I tried a few things, but unfortunately, those are the only options that can delay the test to wait for the Ajax to complete or anything else you would need to wait for.

Kind regards,
Nelson
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Telerik Testing Framework
Asked by
Ozz Karat
Top achievements
Rank 1
Answers by
Missing User
Ozz Karat
Top achievements
Rank 1
Share this question
or