简体   繁体   English

获取闪光灯按钮的位置

[英]Get the location of a flash button

I have a flash button in my site, 我的网站上有一个Flash按钮,

<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 .. ? 是否有可能获取Flash对象的位置(x,y),以便我可以将其指向Java机器人以单击它。 can anyone help me on this .. im using Selenium Webdriver Java - TestNG .. 有人可以使用Selenium Webdriver Java-TestNG在此方面提供帮助吗?

Thanks in Advance .. 提前致谢 ..

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: 例如,在Java中,您可以使用以下代码获取每个Flash对象的坐标和大小:

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);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM