How do you click on a checkbox from a list of checkboxes via Selenium/Webdriver in Java?

后端 未结 8 2042
北海茫月
北海茫月 2020-12-01 22:59

I\'m using Selenium 2 (Webdriver) for automating tests on a webpage. However I wonder if there is way to check checkbox from the list of checkboxes using webdriver framework

8条回答
  •  Happy的楠姐
    2020-12-01 23:35

    This is how I check and uncheck all my boxes, it has to have an Id or class.

    Id example:

    driver.FindElement(By.Id("someid")).click();
    

    ClassName examaple:

    driver.FindElement(By.ClassName("someid")).click();
    

    Its short, its sweet and more importantly it works.

提交回复
热议问题