Get the location of a flash button

荒凉一梦 提交于 2019-12-08 06:40:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!