ruby - Code works in watir-classic but not in watir-webdriver -


when write blow code in watir-webdriver:

$browser.checkbox(:index,0).click

it gives following error:

element not visible (session info: chrome=48.0.2564.97) (driver info: chromedriver=2.9.248315,platform=windows nt 6.1 sp1 x86_64)

and have written code $browser.input(:index,0).click reports error:

unknown error: element not clickable @ point (952, 17). other element receive click: ... (session info: chrome=48.0.2564.97) (driver info: chromedriver=2.9.248315,platform=windows nt 6.1 sp1 x86_64)

but element visible , given above 2 lines of code cleanly works in watir-classic, not need scroll screen.

can suggest me why case? why watir-webdriver not comfortable watir-classic?

<td class="centred"> <label class="label-checkbox"> <input type="checkbox" data-ng-model="cover.isselected" class="ng-pristine ng-valid"> <div class="fake-checkbox"> <span class="glyphicon glyphicon-ok"></span> </div> </label> </td> 

the first thing need update chromedriver, version 2.9 2 years old. binary needs kept date current versions of chrome. quite alone fix issue.

if issue of visibility... purpose of watir (and selenium , webdriver) mimic action of user. if checkbox isn't visible user, shouldn't able click in test.

if checkbox isn't visible @ first, becomes visible, can do: browser.checkbox.when_present.click (note index: 0 default behavior , not necessary)

if checkbox has exciting javascript things covering in way never going visible, , clicking on visible throws "element not clickable" error, might have browser.checkbox.when_present.fire_event :click method not mimic user on site, should used last resort.


Comments