Webaii help need with ddl

6 posts, 0 answers
  1. Andrew
    Andrew avatar
    127 posts
    Member since:
    Sep 2008

    Posted 19 Sep 2011 Link to this post

    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?

  2. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 19 Sep 2011 Link to this post

    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.
  3. Andrew
    Andrew avatar
    127 posts
    Member since:
    Sep 2008

    Posted 19 Sep 2011 Link to this post

    thanks for your help
  4. Andrew
    Andrew avatar
    127 posts
    Member since:
    Sep 2008

    Posted 19 Sep 2011 Link to this post

    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
  5. Andrew
    Andrew avatar
    127 posts
    Member since:
    Sep 2008

    Posted 19 Sep 2011 Link to this post

    .
  6. Andrew
    Andrew avatar
    127 posts
    Member since:
    Sep 2008

    Posted 19 Sep 2011 Link to this post

    got it,

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

     

     

     

Back to Top