如上图,写的xpath能够定位到页面中相应的元素,定位到的元素黄色显示。
visibility!= hidden display != none (is also checked against every parent element) opacity != 0 (in rc2 this is no longer checked for clicking an element) height and width are both > 0 for an input, the attribute type != hidden 如果有不符上面的特性之一,那么就用js脚本来处理,用js操作元素参考博客:http://blog.csdn.net/galen2016/article/details/56847545
如上图,启用流程按钮滑到右边时,该元素增加了display:none属性,此时如要向左滑可以如下方法来定位 WebElement label = driver.findElement(By.xpath(“//div[@class=’el-switch__label el-switch__label’ and not(contains(@style,’display:none’))]”));