问题
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