TA的每日心情 | 无聊 5 天前 |
---|
签到天数: 530 天 连续签到: 2 天 [LV.9]测试副司令
|
1测试积点
求助为何会报 no such element: Unable to locate element: {"method":"css selector","selector":"[testid="editItem"]"} 错误
代码:
- public WebElement findElement(By by){
- if (!waitEle(by)){
- throw new RuntimeException("cannot find ele : " + by);
- }
- return webElement.findElement(by);
- }
复制代码- private Boolean waitEle(By by) {
- if (by == null){
- return false;
- }
- WebDriverWait wait = new WebDriverWait(driver, waitTimeDefault);
- try {
- wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(by));
- } catch (Exception e) {
- return false;
- }
- return true;
- }
复制代码 报错如下:
我先等待元素存在再去查找元素,为何还是找不到该元素
|
|