How to click the checkbox using Selenium WebDriver and C#

前端 未结 4 508
挽巷
挽巷 2021-01-24 15:01

What I\'m trying to do is click on (or off) any of the checkboxes on my page. As you can see from the HTML, each checkbox element would appear to have a unique identifier but w

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-24 15:23

    Use the following CSS Selector for that:

    .url-field-toggle[data-yesno-name='Url_Transaction_Out']
    

    Code is:

    driver.FindElement(By.CssSelector("url-field-toggle[data-yesno-name='Url_Transaction_Out']")).Click();
    

    Hope it helps you!

提交回复
热议问题