问题
I have a flash button in my site,
<object id="p17p316lo71o2j_flash" width="100%" height="100%" style="outline:0" type="application/x-shockwave-flash" data="http://testsite.com/includes/plupload/.../js/plupload.flash.swf"><param name="movie" value="http://testsite.com/includes/plupload/.../js/plupload.flash.swf"><param name="flashvars" value="id=p17p316lo71o2j"><param name="wmode" value="transparent"><param name="allowscriptaccess" value="always"></object>`
is it possible to get the flash object location (x,y) so that i can point that to the java robot to click on it .. ? can anyone help me on this .. im using Selenium Webdriver Java - TestNG ..
Thanks in Advance ..
回答1:
Yes, it's possible to get not only its location, but also its size. For instance, in Java you can get the coordinates and size of every flash object with this code:
listFlash = _driver.findElements(By.xpath("//object[@type=\"application/x-shockwave-flash\"]"));
for (WebElement flash: listFlash)
{
System.out.println("Coordinates: " + flash.getLocation().x + ", " + flash.getLocation().y);
System.out.println("Size: " + flash.getSize().width + ", " + flash.getSize().height);
}
来源:https://stackoverflow.com/questions/16235235/get-the-location-of-a-flash-button