开发者

Capybara Cucumber test fail to find xpath when browser is minimized

开发者 https://www.devze.com 2023-03-29 15:18 出处:网络
I\'m running a scenario where form fields are automatically filled in with invalid val开发者_StackOverflow社区ues which trigger some javascripts to show warnings under each incorrectly filled field wh

I'm running a scenario where form fields are automatically filled in with invalid val开发者_StackOverflow社区ues which trigger some javascripts to show warnings under each incorrectly filled field when I blur. The test passes when the browser is in focus. It finds the xpath with the "expected warning" that I pass. But if I minimize or just click on another application, it fails to find the xpath.

I'm running Firefox 3.6 (going to update it soon) and the way I'm doing to find the xpath is by using "page.should have_xpath(xpath)"

Does anyone have any idea how what might solve this? It's really important for me to run it with the browser minimized.

Edit and alternative solution:

I guess the timing issue that occurs in events such as blur followed by finding a certain xpath in a minimized browser inherent to the driver itself. Therefore, I decided to run the tests in a Virtual Frame Buffer using xvfb in Linux and it seems to be working really well. I'm planning on applying this to be triggered by Hudson/Jenkins whenever a change is committed.


Could it be a timing issue? Perhaps if the browser isn't frontmost and maximised, the rendering is not happening quickly enough for the content be present when Capybara checks for it.

Also: How are you triggering the blur event?

0

精彩评论

暂无评论...
验证码 换一张
取 消