0

I am running selenium tests in java on a website that is using Silverlight:

One test example is:

   public double getVideoBitrate()
   {
      return Double.valueOf(executeBridgeCommand("Diagnostics.CurrentBitrate").toString());
   }

the Problem I've run into is that when running on a Jenkins slave, i have no guarantee that silverlight is active so my tests fail. How do I activate it in the browser? These commands (at least for Firefox) look as if they are what i'm looking, but I don't know what preferences to set or how to find them for silverlight.

FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.setPreference("browser.download.folderList",2);
firefoxProfile.setPreference("pdfjs.disabled", true);
firefoxProfile.setPreference("pdfjs.firstRun", false);

(copied from Selenium disable plugins in firefox profile)

I also need to ensure that silverlight is active in Chrome and IE as well.

3 Answers 3

0

If you are simply validating that Silverlight is enabled, then you should be able to do this:

WebElement silverlightElement = driver.findElement(By.cssSelector("object[type='application/x-silverlight-2']");

Then do what you will with it.

However, please note that this is the extent that you can do with Selenium. You can validate the attributes that are revealed in the HTML, but anything inside of the Object, is out of Selenium's Scope. Selenium cannot automate anything embedded like PDF, Flash, Java Applets, Silverlight, etc.

3
  • Will this actually validate that the plugin is enabled, or just validate that the object exists in the DOM? I do not know - I am genuinely interested.
    – SiKing
    Apr 1, 2015 at 18:36
  • it will only validate that the object is present in the DOM
    – ddavison
    Apr 1, 2015 at 19:56
  • funny, now that i look back on this question - i'm not sure i answered the op's question. :)
    – ddavison
    Apr 1, 2015 at 19:57
0

there is a silverlight selenium plugin that can get such information as video rates and do other operations as well.

0

Well, as Microsoft is no longer supporting Silverlight, my company moved onto using Flashplayer so this question is now moot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.