首页 > 解决方案 > 使用 by,linktext 时无法定位元素

问题描述

我正在尝试在以下位置测试过滤器功能

https://todomvc.com/examples/vue/

用户可以单击“全部”“活动”或“已完成”来过滤列表。

java类:

public static By filterButtonWithLabel(String filters) {
    return By.linkText(filters);
}

错误:

Caused by: org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"link text","selector":""Active""}

这个错误是关于什么的?那是告诉我不能使用by.linktext吗?

标签: csscss-selectorscucumber-javacucumber-serenity

解决方案


我只是意识到这是我不应该使用双引号的步骤问题,只需直接输入字符串“Completed”即可。

And I filter the list to show Completed tasks

推荐阅读