0
ff.findElementByxpath(//object[@ id='slPlugin2']).click();

is not recognizing the element.

And also suggest me the way to upload media through webdriver

<table class="imgTable photoTable" cellspacing="0">

<div id="fileUploadControl404" class="fileUpload t-toolbar t-grid-toolbar t-grid-top">

<object id="slPlugin2" width="117" height="32" data="data:application/x-silverlight," type="application/x-silverlight">

<param value="/LMM/ClientBin/FileUpload.xap" name="source">

<param value="Url =https://lmmwipqa.blob.core.windows.net/uploads?se=2013-12-28T07%3A18%3A43Z&sr=c&sp=w&sig=fxuPdwl4huKRISO%2BCPdZIQxh0i5cdnGjWKO8okj2O34%3D, Parent =fileUploadControl404, Caption =Add Photo" name="initParams">
</object>
</div>
Amith
  • 6,818
  • 6
  • 34
  • 45

2 Answers2

0
//object[@ id='slPlugin2']

The above parameter should be within double quotes,i.e., a string should be passed as parameter to findElementByXPath().

The required statement can be rewritten as follows :

ff.findElementByXPath("//object[@id='slPlugin2']").click();

With respect to clicking on invisible elements, the following statement can be used : (Note : This assumes the page has jQuery on it)

((JavascriptExecutor)driver).executeScript("$('selector_of_element').click();");

For file upload you can refer this.

Community
  • 1
  • 1
Amith
  • 6,818
  • 6
  • 34
  • 45
0

I think, ff.findElementById("slPlugin2") would be more shorter way to find the element, but, anyway unfortunatelly, WebDriver will be not be able to handle the elements inside the Silverlight embeded app.

I'd recomend to get the parent div: ff.findElementById("fileUploadControl404")

Get its coordinates with .getLocation();

Use Java Robot or Sikuli in order to manipulate the embeded control.

Dmytro Zharii
  • 291
  • 4
  • 14