尝试将您的定位器转换为通过链接文本查找元素,例如:driver.findElement(By.linkText("Accept"))或使用 XPath定位器,例如:driver.findElement(By.xpath("//a[text()='Accept']"))I have this<li><a class="dropdown-item" href="{{route('user.invite_accept',[$user->id,1])}}">Accept</a></li>I am trying to click on it using laravel dusk I used select, click,clicklink But it doesn't work 解决方案 Your selector seems to be wrong, it appears that you're trying to click a hyperlink which is represented by <a> tag while your CSS expression is looking for a <select>Try converting your locator to find element by link text like:driver.findElement(By.linkText("Accept"))or alternatively use the XPath Locator like:driver.findElement(By.xpath("//a[text()='Accept']")) 这篇关于没有这样的元素:无法找到元素:{“方法":"css选择器",“选择器":“主体选择[名称='接受']"}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!