Automation of Silverlight controls using Selenium

13 posts, 0 answers
  1. kiljaden wow
    kiljaden wow avatar
    5 posts
    Member since:
    May 2010

    Posted 06 May 2010 Link to this post

    Hi,

    I am trying to automate web based application based on Silverlight technology. For this purpose i am using Selenium rc and making use of java for the automation purpose. Can anyone give me a simple code in java how to automate any silverlight object lets say a button or a dropdown etc. I tried googling but when it comes to automation of silverlight using selenium, I am not getting anything which is relevant to my use. Please help me out.

    Thanks in advance,
    Kil
  2. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 06 May 2010 Link to this post

    Hi Kil,

    You can take a look at our automated studio for silverlight and ajax.
    http://www.telerik.com/products/web-testing-tools.aspx

    All the best,
    Valentin.Stoychev
    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.
  3. DevCraft banner
  4. kiljaden wow
    kiljaden wow avatar
    5 posts
    Member since:
    May 2010

    Posted 06 May 2010 Link to this post

    Hi,

    My project requirement is such that I have to use Selenium Rc using Java script for automation purpose. Can you please post a sample java code to automate any silverlight object like a drop down menu or button etc.


    Thanks,
    Kil
  5. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 06 May 2010 Link to this post

    Hello kiljaden wow,

    you need to work with the html bridge to achieve this. Please take a look at this tutorial:
    http://www.silverlight.net/learn/quickstarts/htmlbridge/

    We don't have anything specific in our controls - so you should be able to access them as any managed object in SL.

    Sincerely yours,
    Valentin.Stoychev
    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.
  6. kiljaden wow
    kiljaden wow avatar
    5 posts
    Member since:
    May 2010

    Posted 06 May 2010 Link to this post

    Hi,

    Thanks for the speedy response. Let me look into this and i will get back to you if i need some further help.

    Cheers,
    Kil
  7. kiljaden wow
    kiljaden wow avatar
    5 posts
    Member since:
    May 2010

    Posted 14 May 2010 Link to this post

    Hi,

    My aim is to set a value in a drop down menu of a website designed in silverlight through a java code. I am trying to automate using Selenium Rc. Can anyone help me out with this? Any pointers on this is highly appreciated.


    Thanks in advance,
    Kil
  8. Vladislav
    Admin
    Vladislav avatar
    276 posts

    Posted 18 May 2010 Link to this post

    Hi kiljaden wow,

    In order to achieve your goal, you basically have to do the next steps:

    1. Create your SL application with the desired drop-down menu.
    2. Create a way to set the content of the drop-down menu (probably a Button, whose "Click" event handler, sets the content).
    3. Expose this method to JavaScript as is described here.
    4. Create an html button in the host page and bind its "onclick" event to the method exposed from the SL.
    5. Record a test against this page with "Selenium IDE". In this test you will just push the HTML button and it will set the content of the drop-down menu in the SL application,
    6. Export the recorded test as "JUnit" test.

    At this point you should have the desired test in JAVA, which you can further alter or improve.

    Best wishes,
    Vladislav
    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.
  9. kiljaden wow
    kiljaden wow avatar
    5 posts
    Member since:
    May 2010

    Posted 18 May 2010 Link to this post

    Hi Vladislav ,

    Selenium IDE fails to capture the actions performed on a Silverlight object. Thats the reason why I am writing a script manually and trying to interact with SL objects. If you have any other solution, I will be glad to implement it.

    Thanks in advance,
    Kil
  10. Vladislav
    Admin
    Vladislav avatar
    276 posts

    Posted 21 May 2010 Link to this post

    Hello kiljaden wow,

    I have prepared a sample project for you.
    It demonstrates how to expose Silverlight methods to JavaScript, which can be called from the host HTML page and how to connect this method to a simple action, like the "onclick()" method of a regular HTML button.
    In this project, there is a simple Silverlight application with one RadDropDownButton (without content initially) and a Button, which sets the content of the above control.
    In the host HTML page, there is a regular HTML button, which also sets the content of the RadDropDownButton inside the Silverlight.
    There is a folder named "Selenium" in the attached project, which contains one very simple test directly recorder with the Selenium IDE. And the same test, exported as "JUnit" test.

    I hope that this example will give you "an overview" of how you can interact with the Silverlight application using Selenium.

    Greetings,
    Vladislav
    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.
  11. sri sri
    sri sri avatar
    1 posts
    Member since:
    Feb 2010

    Posted 03 Jul 2010 Link to this post

    Hi ,
    I am trying to automate silverlight application using selenium RC, can any body tell the procedure,
    Is it same as automating flex using selenium RC.

    Thanks,
    Sri
  12. Vladislav
    Admin
    Vladislav avatar
    276 posts

    Posted 07 Jul 2010 Link to this post

    Hi sri sri,

    You can check my previous posts in this thread.
    They contain a description of the procedure along with a small sample project demonstrating it.

    Please don't hesitate to ask if you have additional questions/comments on the subject.

    Kind regards,
    Vladislav
    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
  13. mohit
    mohit avatar
    1 posts
    Member since:
    Aug 2010

    Posted 23 Aug 2010 Link to this post

    Hi Everyone,

    i have 2 queries
    1.Is it possible to test silverlight application using selenium as i am not able to view sourcecode and that is why i am not able to enter the exact parameter.
    2.I get an XHTML doc from my developers end but i am not able to write script from it.
    is there any plugin available to view source code and if available how to use it with selenium ide and rc
    please mention steps

    thanks in advance
    mohit
  14. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 25 Aug 2010 Link to this post

    Hello mohit,

    Selenium can be used for testing Html  (Web apps). Integrating it with Silverlight will require exposing each needed proeprty / object as a scriprable member in the Silverlight application's code which may me not be maintainable.

    This is an OS project for this:

    http://code.google.com/p/silverlight-selenium/

    Our Web UI Test studio can be used for painless functional tests for Silverlight:

    http://www.telerik.com/automated-testing-tools/products/silverlight_testing.aspx

    Kind regards,
    Miroslav
    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
Back to Top
DevCraft banner