2016-08-04 42 views
-4

enter image description here请帮我解决这个问题。参考上面的图片。获取HTML中的属性值

+3

而不是屏幕截图需要在这里分享您的代码..并指定您的编程语言以及.. –

+0

可能重复的[如何获得webdriver中的div内的属性值](http://stackoverflow.com/questions/ 17592786 /如何对获得属性 - 值内-A-DIV-在-的webdriver) – JeffC

回答

2
WebElement element = driver.findElement(By.id("mod-sellerRating-9")); 
String dataSellerRating = element.getAttribute("data-sellerrating"); 

如上所述,我会用By.id而非By.xpath