如何在页面加载时用水豚和硒火 Ajax 制作黄瓜
我有以下黄瓜故事:
@javascript
Scenario: Showing the page
Given I am a logged in user
And there is a member with a site
And I go to the home page
.....
加载主页时,页面上有一个通过 AJAX 填充的下拉菜单,在 selenium 运行浏览器测试中,该
$(document).ready(function(){})
下拉菜单未运行,因此我需要选择一个下拉菜单使用不存在。有没有什么方法可以强制 Selenium 通过一个步骤触发 javascript 事件以进行页面加载,也许
当页面加载时,通过 AJAX
或类似的方式检索有关成员的信息。我需要那个下拉框,但由于应用程序的其他部分使用导航下拉菜单中的一些操作缓存,但有时应该有这个额外的下拉菜单,我在使用javascript加载它们后,我无法真正改变它。
有什么想法吗?
编辑: 事实证明,我设置了一些错误的测试数据,并且没有达到它的条件,所以看起来像往常一样,库是好的,而我犯了一个错误,所以看起来这会很好。
I have the following as a cucumber story:
@javascript
Scenario: Showing the page
Given I am a logged in user
And there is a member with a site
And I go to the home page
.....
When that home page is loaded, there is a drop down that is populated via AJAX on page, in the selenium run browser test the
$(document).ready(function(){})
is not run and as such a drop down select that I need to use is not present. Is there any way that I can force Selenium to fire a javascript event for page load via a step maybe
When the page is loaded information about members is retrieved via AJAX
or something like that. I need that dropdown box, but due to some Action Caching in other parts of the application that use the navigation drop downs but should only sometimes have this extra drop down I load them in after with javascript, I can't really change that.
Any Ideas?
EDIT:
It turns out I had set up some test data wrong and that was failing a condition for it, so it seems that as usual the library is fine and I made a mistake, so it seems this will be fine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论