Failed to click checkboxes with Robot Framework and selenium2library
I have used 3 different waits to place an element (checkbox) on the page as shown below and they are passed. After that, I click on the same element that is also passed.
Now my question is that the click element method is being passed and then why the checkbox should be selected because in the click element method I only click that checkbox !!
Screenshot of HTML.
I've tried this checkbox click several times using various strategies, but it fails every time. Please help and suggest some solution!
I wrote the code:
` sleep 2
wait until page contains element id_service_levels_0
wait until element is enabled id=id_service_levels_0
wait until element is enabled id=id_service_levels_0
page should contain element id=id_service_levels_0
click element id=id_service_levels_0
checkbox should be selected id=id_service_levels_0
`
+3
Sammy
source
to share
1 answer
You can try with JavaScript executor as shown below.
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("document.getElementById('id_service_levels_0').click()");
+1
Murthi
source
to share