无法使用 Selenium webdriver 在 Internet Explorer 中单击单选按钮
Unable to click radio button in Internet explorer using Selenium webdriver
我无法使用 Selenium 网络驱动程序单击单选按钮。
html如下
<input name="PersonalDetails.Paperless" class="input-validation-error" id="Paperless" type="radio" data-val-required="Contract notes selection is required" data-val="true" value="true"/>
要点击的代码如下。它适用于 Chrome 和 FireFox,但不适用于 Ie
driver.FindElement(By.CssSelector("label[for='OnlineAndPost']")).Click();
对于 IE,最好尽可能简单,尤其是在处理 CSS 选择器时,获取元素 by编号:
driver.FindElement(By.Id("Paperless")).Click();
我无法使用 Selenium 网络驱动程序单击单选按钮。
html如下
<input name="PersonalDetails.Paperless" class="input-validation-error" id="Paperless" type="radio" data-val-required="Contract notes selection is required" data-val="true" value="true"/>
要点击的代码如下。它适用于 Chrome 和 FireFox,但不适用于 Ie
driver.FindElement(By.CssSelector("label[for='OnlineAndPost']")).Click();
对于 IE,最好尽可能简单,尤其是在处理 CSS 选择器时,获取元素 by编号:
driver.FindElement(By.Id("Paperless")).Click();