如何从href获取值?
像这样:
<div id="cont"><div class="bclass1" id="idOne">Test</div>
<div id="testId"><a href="**NEED THIS VALUE AS STRING**">
<img src="img1.png" class="clasOne" />
</a>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我需要将该值作为字符串.
我试过这个:
String e = driverCE.findElement(By.xpath("//div[@id='testId']")).getAttribute("href");
JOptionPane.showMessageDialog(null, e);
Run Code Online (Sandbox Code Playgroud)
但只返回NULL值...