自动化定位方式
1、String Xpath = String.format("//*[@id=\"saveFileKeyWordsBtnHand\"]/../../..//span[text()=\"%s\"]/../label[@title=\"删除\"]",fileTag);
//1.首先找到id=saveFileKeyWordsBtnHand
//2.id的上级、上级、上级、下级找到span属性
//3.span属性文本内容通过匹配的方式找到 [text()=\"%s\"]及[text()=\"fileTag\"]
//4.匹配到span内容后,上级找到label,其title为删除 label[@title=\"删除\"]
WebDriverUtil.findElementAndClick(driver,By.xpath(Xpath),"删除");
2、WebDriverUtil.findElementAndClick(driver, By.xpath("//*[@id=\"flexsafeWebApp\"]/body/top-menu/div[2]/nav[2]/div/div[2]/div/ul[1]//a[contains(text(),\"搜索\")]"),"点击搜索标注");
3、String editeButtonXpath = String.format("//*[@id=\"saveFileKeyWordsBtnHand\"]/../../..//span[text()=\"%s\"]/../label[@title=\"编辑\"]",oldTag);
WebDriverUtil.findElementAndClick(driver,By.xpath(editeButtonXpath),"编辑");
4、String fileXpath2 = String.format("//*/a[contains( @href,\"%s\")]/../..//label/button[@type=\"button\"]",fileId);
WebDriverUtil.findElementAndClick(driver,By.xpath(fileXpath2),"");