内容简介:翻译自:https://stackoverflow.com/questions/28536948/protractor-button-click-and-open-page-in-new-tab
我对Protractor相当新.
我正在尝试自动化一个场景,我单击一个按钮,它在新选项卡中打开一个页面,然后我们需要在新页面中填写表单并提交.
问题:当我点击按钮打开新页面时.我的测试不会等待加载新页面并说测试完成和成功消息.
我使用该按钮的简单点击事件来点击按钮.
element(by.id(“newPlan”)).click()
我错过了什么吗?我需要做一些事情,以便我的测试等待新页面加载,然后我可以执行一些功能吗?
element(by.id("newPlan")).click().then(function () {
browser.getAllWindowHandles().then(function (handles) {
newWindowHandle = handles[1]; // this is your new window
browser.switchTo().window(newWindowHandle).then(function () {
// fill in the form here
expect(browser.getCurrentUrl()).toMatch(/\/url/);
});
});
});
翻译自:https://stackoverflow.com/questions/28536948/protractor-button-click-and-open-page-in-new-tab
以上所述就是小编给大家介绍的《angularjs – 量角器按钮在新选项卡中单击并打开页面》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Agile Web Development with Rails 4
Sam Ruby、Dave Thomas、David Heinemeier Hansson / Pragmatic Bookshelf / 2013-10-11 / USD 43.95
Ruby on Rails helps you produce high-quality, beautiful-looking web applications quickly. You concentrate on creating the application, and Rails takes care of the details. Tens of thousands of deve......一起来看看 《Agile Web Development with Rails 4》 这本书的介绍吧!