我会推荐以下内容:
查看http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/Dimension.html 库;
文本分析算法我建议如下:
1) 您正在选择网页的边框并将页面的边框初始化为 webElements;
Stirng cssBorder="abracadabra";
WebElement border=driver.findElement(By.cssSelector(cssBorder));
2) 然后你会发现所有代表文本的 webElements:
String cssText1="...";
String cssText2="....";
......
WebElement text1=driver.findElement(By.cssSelector(cssText1));
WebElement text2=driver.findElement(By.cssSelector(cssText2));
3) 在上述步骤之后,将getSize(); getLocation(); 函数应用于找到的 webElements:
text1.getSize();
text1.getLocation();
根据这些函数将返回的结果:
例如:
{'y': 202, 'x': 165}
{'width': 77, 'height': 22}
您将能够比较返回的结果并分析 webElements 的相对位置;
这里也提示您的问题:Selenium: get coordinates or dimensions of element with Python
希望对你有所帮助。