Actions on HTML content within Silverlight

5 posts, 0 answers
  1. Harinee
    Harinee avatar
    6 posts
    Member since:
    Mar 2015

    Posted 11 Mar 2015 Link to this post

    Hi,

    We have a Silverlight application hosting an iframe within it.

    Finding element works well. But actions are giving me a tough time.
    I am trying to click or scroll to an HTML element using :

    1) Browser Actions:
    Browser.Actions.ScrollToVisible(element);
    Browser.Actions.Click(element);

    This throws an exception.

    2) Html control class 
    element = frame.Find.ByExpression<HtmlInputRadioButton>("class=FICheckRadio");
    element.InvokeEvent(ScriptEventType.OnClick);

    This does highlight the radio button, and does not throw any exception. BUT does not actually click on the element.

    Is there another way to act on the elements within HTML withing Silverlight?




  2. Harinee
    Harinee avatar
    6 posts
    Member since:
    Mar 2015

    Posted 11 Mar 2015 Link to this post

    Ha!
    Resolved sooner than I thought.

    element= frame.Find.ByAttributes<HtmlInputRadioButton>("class=FICheckRadio");
    element.Check(true, true, true);

    But wondering why element.InvokeEvent(ScriptEventType.OnClick) didn't work
  3. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 16 Mar 2015 Link to this post

    Hello Harinee,

    Glad to hear you were able to solve the problem experienced.

    Regarding element.InvokeEvent(ScriptEventType.OnClick) not working, I guess this is expected, since this is supposed to trigger javascript event, not to perform actual click, check in your case.

    Regards,
    Ivaylo
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
  4. Harinee
    Harinee avatar
    6 posts
    Member since:
    Mar 2015

    Posted 18 Mar 2015 in reply to Ivaylo Link to this post

    Hi,

    Thank you for the response.
    Just one more question:
    Technically, what is difference between element.Check(true, true) and element.Click(true)
    in this case?
  5. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 19 Mar 2015 Link to this post

    Hello Harinee,

    The first boolean value is whether the radio button is checked, the second boolean value is whether to invoke on click event.

    Refer to the screenshot attached for more clarity.

    Regards,
    Ivaylo
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
Back to Top