web端代码如下:
1、直接通过xpath定位,失败
WebElement text =driver.findElement(By.xpath("/html/body/div[4]/div[1]/div[1]"));
报错:org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"/html/body/div[4]/div[1]/div[1]"}
2、通过class定位,失败:
WebElement text =driver.findElement(By.xpath("//*[@class=\"el-select-dropdown__wrap el-scrollbar__wrap\"][2]"));
报错:org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@class="el-select-dropdown__wrap el-scrollbar__wrap"][2]"}
求大神帮忙,指点
网友评论