【发布时间】:2020-11-07 16:36:32
【问题描述】:
我试图让我的程序点击一个按钮,但我收到错误。
我的代码:
driver.FindElementById("couponsinc-gallery-selectall").Click();
错误:
An unhandled exception of type 'OpenQA.Selenium.NoSuchElementException' occurred in WebDriver.dll
no such element: Unable to locate element: {"method":"css selector","selector":"#\couponsinc\-gallery\-selectall"}
这是页面上按钮的代码:
<div class="selectall">
<input type="checkbox" class="selectall-chk" id="couponsinc-gallery-selectall">
<label for="couponsinc-gallery-selectall">Clip All</label>
</div>
我也尝试过使用FindElementByClassName,但没有任何效果。我做错了什么?
【问题讨论】:
标签: c# selenium xpath css-selectors webdriverwait