-4
請幫我解決這個問題。參考上面的圖片。獲取HTML中的屬性值
請幫我解決這個問題。參考上面的圖片。獲取HTML中的屬性值
WebElement element = driver.findElement(By.id("mod-sellerRating-9"));
String dataSellerRating = element.getAttribute("data-sellerrating");
如上所述,我會用By.id
而非By.xpath
。
而不是屏幕截圖需要在這裏分享您的代碼..並指定您的編程語言以及.. –
可能重複的[如何獲得webdriver中的div內的屬性值](http://stackoverflow.com/questions/ 17592786 /如何對獲得屬性 - 值內-A-DIV-在-的webdriver) – JeffC