本文介绍了需要在空手道 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/直觉/空手道/问题/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.

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

07-30 08:56