没有这样的元素:无法找到元素:{“方法":"css选择器",“选择器":“主体选择[名称='接受']"} [英] no such element: Unable to locate element: {"method":"css selector","selector":"body select[name='Accept']"}
本文介绍了没有这样的元素:无法找到元素:{“方法":"css选择器",“选择器":“主体选择[名称='接受']"}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个
<li><a class="dropdown-item" href="{{route('user.invite_accept',[$user->id,1])}}">Accept</a></li>
我正在尝试使用laravel黄昏来点击它,我使用了select,click,clicklink 但这不起作用
解决方案
您的选择器似乎有误,似乎您正在尝试点击 <a>
表示标签,而您的CSS表达式正在寻找 <select>
>
尝试将您的定位器转换为通过链接文本查找元素,例如:
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选择器",“选择器":“主体选择[名称='接受']"}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文