本文介绍了需要在Karate UI的Chrome浏览器中切换2个标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮帮我.我被卡在选项卡切换中.问题-当我单击按钮(实际网站行为)时,新页面在新选项卡中打开,我也重定向到新选项卡.但是,当我执行测试时,调试表明我在同一页面上,没有被重定向到新页面.我需要切换到空手道中新打开的标签页.

Please, help me. I am stuck in tabs switching.The problem - when I click the button (real site behavior), the new page is opened in the new tab and I am redirecting to the new tab too. But when I execute the test, debugging shows, that I am on the same page, that I wasn't redirected to the new one. I need to switch to the new opened tab in Karate.

我尝试使用这些命令->

I tried to use these commands ->

back()
forward()
switchPage()

我找不到路.

提前谢谢!

推荐答案

switchPage() 应该可以,请尝试标题或URL.

switchPage() should work, try with the title or URL.

否则,请按照以下过程进行操作,以便我们对其进行修复: https://github.com/intuit/karate/tree/develop/examples/ui-test

Else please follow this process so that we can fix it: https://github.com/intuit/karate/tree/develop/examples/ui-test

我们提出了一个简化此问题的方法: https://github.com/intuit/karate/issues/1210

we opened an issue to make this easier: https://github.com/intuit/karate/issues/1210

所以现在这将起作用:

* driver 'https://mail.ru/'
* waitFor('.news-main__title').click()
* switchPage('news.mail.ru')
* match driver.title == 'Mail.ru: почта, поиск в интернете, новости, игры'

如果您从源代码构建并进行验证,那就太好了,因此我们可以确认:https://github.com/intuit/karate/wiki/Developer-Guide

It will be great if you build from source and validate, so we can confirm: https://github.com/intuit/karate/wiki/Developer-Guide

否则,您可能需要等待一个星期才能发布下一个RC.

Else you may need to wait a week for the next RC release.

这篇关于需要在Karate UI的Chrome浏览器中切换2个标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 13:23