开发者

How to check Space between Two images

开发者 https://www.devze.com 2023-04-13 09:26 出处:网络
Consider there are two images in a webpage. I want know if they have any space rendere开发者_如何学运维d between them.

Consider there are two images in a webpage.

I want know if they have any space rendere开发者_如何学运维d between them.

I'm using selenium tool and python language.

Answer could be in any language.


you can look up the position and size of each image quickly with javascript (I'm using jquery)

$('#image-one').width

                height

                x

                y

$('#image-two')...same thing

Just see if the x of one is right next to the x+width of the other. Repeat for Y.

edit: there may be some issues with parents that have relative positioning. The code here is probably more bulletproof than just using x and y:

http://blog.firetree.net/2005/07/04/javascript-find-position/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号