简体   繁体   中英

Form not submitted on click using watir-webdriver in Chrome

I am using ruby/cucumber/watir-webdriver and the page-objects gem to run my tests. My tests are usually run in firefox but decided to give chrome a try. While the click works in firefox it does not in chrome. Here is the sample html code:

<form id='test-form' method='post' class='validate-inline'>
...
  <div class='margin-top'>
    <input class='btn' data-disable-with='wait...' type='submit' value='Submit Form'></input>
  </div>
</form

In my class page I have the button declared as the following:

button(:submit_form_btn, :value => 'Submit Form')

And call it this way:

submit_form_btn_element.when_present.click

I do see the button text change to 'wait...' for a few seconds then returns to 'Submit Form' but does not seem to submit the form. As mentioned before it works with firefox and when clicked manually. Just seems to be an issue in Chrome. Any ideas how to get around it? I tried clicking the div, and tried clicking the button twice but same issue.

As always your help is appreciated. Thanks.

I know this question is little old now, but I thought I'd post in case this helps anyone.

Most of the times I've run into similar issues, it was caused by an update to Chrome that caused issues with the version of the watir-webdriver gem (or one of it's dependencies) or with the version of chromedriver that I was using. I've had success in the past by updating my gems and chromedriver and the other times I've had to roll back the browser version to the previous release.

It's not ideal to be testing on an older version of chrome but it worked fine as a stop gap until the issue was fixed.

If you do go for the previous version of chrome approach, make sure to log a bug ticket if there isn't already one there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM