简体   繁体   English

未使用Chrome中的watir-webdriver点击提交表单

[英]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. 我正在使用ruby / cucumber / watir-webdriver和page-objects gem运行测试。 My tests are usually run in firefox but decided to give chrome a try. 我的测试通常在Firefox中运行,但决定尝试chrome。 While the click works in firefox it does not in chrome. 虽然单击在Firefox中有效,但在chrome中不起作用。 Here is the sample html code: 这是示例html代码:

<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. 如前所述,它可以与firefox一起使用,也可以在手动单击时使用。 Just seems to be an issue in Chrome. 在Chrome中似乎只是一个问题。 Any ideas how to get around it? 任何想法如何解决它? I tried clicking the div, and tried clicking the button twice but same issue. 我尝试单击div,然后尝试单击两次按钮,但问题相同。

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. 在大多数情况下,我遇到类似的问题,这是由于Chrome的更新引起的,该更新导致watir-webdriver gem的版本(或其依赖项之一)或我使用的chromedriver版本出现问题。 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. 过去,我通过更新gems和chromedriver获得了成功,而其他时候我不得不将浏览器版本回滚到以前的版本。

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. 在较旧版本的chrome上进行测试不是理想的方法,但是在问题解决之前,它可以很好地解决问题。

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. 如果确实要使用chrome方法的先前版本,请确保记录一个故障单(如果还没有的话)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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