在下面的 HTML 中,我需要使用 Selenium Webdriver 获取登录值。
<div
roletitle="MD"
careteamrole="HOSPITALIST"
login="adamss"
isconsultctm=""
title="Adams Samuel"
style=""
class="assign_grid assign_grid_selected"
id="97">
</div>
我尝试了以下方法,但失败了:-
WebElement getAssigneeLoginWebElement = ieDriver.findElement(By.cssSelector(".assign_grid assign_grid_selected"));
sAssignedCTMLoginId = getAssigneeLoginWebElement.getAttribute("login");
sAssignedCTMLoginId = ieDriver.findElement(By.className("assign_grid assign_grid_selected")).getAttribute("login");
sAssignedCTMLoginId = ieDriver.findElement(By.xpath("//*[@class='assign_grid assign_grid_selected']/@login[1]")).getText();
先感谢您