no such element: Unable to locate element: {“method”:“css selector”,“selector”:“body select[name='Accept']”}

[亡魂溺海] 提交于 2019-12-19 12:28:10

问题


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


回答1:


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']"))


来源:https://stackoverflow.com/questions/56276682/no-such-element-unable-to-locate-element-methodcss-selector-selector

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!