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

Webaii help need with ddl

5 Answers 100 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Veteran
Iron
Andrew asked on 19 Sep 2011, 04:34 PM
I am trying to write a script for this page using straight webaii (not using recording feature in vs) for this page

http://www.letthememoriesbegintour.com/index.php?view=form

I want to select a value from the county ddl "Canada" (and I can) but it will not cause the update of the state ddl to occure so it gets filled with proviences.

any idea?

5 Answers, 1 is accepted

Sort by
0
Anthony
Telerik team
answered on 19 Sep 2011, 05:57 PM
Hi Andrew,

You must add code to manually fire the jQuery event so subsequent dependent drop-downs are properly populated. Here is sample code that works against that site:

Manager.LaunchNewBrowser();
 
HtmlSelect country = Find.ByExpression<HtmlSelect>("id=country");
//Scroll the browser so we can visually confirm the drop-down selections
country.ScrollToVisible();
country.SelectByValue("CA");
 
//Manually invoke the jQuery event. You can reuse this line and change the ID to match the applicable control.
Actions.InvokeScript("$('#country').change()");
 
HtmlSelect state = Find.ByExpression<HtmlSelect>("id=state");
state.SelectByValue("Yukon");
 
//Short pause to visually confirm the drop-down selections were correctly made
System.Threading.Thread.Sleep(2000);


For more information, please read this article.

Greetings,
Anthony
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Andrew
Top achievements
Rank 1
Veteran
Iron
answered on 19 Sep 2011, 06:06 PM
thanks for your help
0
Andrew
Top achievements
Rank 1
Veteran
Iron
answered on 19 Sep 2011, 06:17 PM
i pased this code into mine:
Actions.InvokeScript("$('#country').change()");

but in vs is shows as underline and the tooltip says:
C#: There is no sucj reference available here

do I need to ref a new assembly
0
Andrew
Top achievements
Rank 1
Veteran
Iron
answered on 19 Sep 2011, 06:24 PM
.
0
Andrew
Top achievements
Rank 1
Veteran
Iron
answered on 19 Sep 2011, 06:31 PM
got it,

browser.Actions.InvokeScript("$('#country').change()");

 

 

 

Tags
General Discussions
Asked by
Andrew
Top achievements
Rank 1
Veteran
Iron
Answers by
Anthony
Telerik team
Andrew
Top achievements
Rank 1
Veteran
Iron
Share this question
or