selenium 怎么处理display:none
页面HTML是这样的:
....
<div class="cf w index-middle"><div id="li" class="flea r li">
<a class="pic" href="http://XXX.com/"></a>
<a href="http://XXX.com/"></a>
</div>
<a class="text-a" href="http://XXX.com/" style="display: none; opacity: 1;">查看</a>
</div>
.....
处理方法是用js把隐藏的显示出来,方法如下:
JavascriptExecutor j=(JavascriptExecutor)driver;
j.executeScript("document.getElementById('li').style.display='block';");
driver.findElement(By.xpath("Xpth路径")).click();