问题描述
我在使用空手道UI切换选项卡时遇到问题.我的代码如下:
I am having an issue with switching tabs using Karate UI. My code is as follows:
Scenario: SwitchPage Test
Given driver 'original URL'
* retry(5, 10000).waitFor('#someID')
* input('#someID', ['numbers', 'input', Key.ENTER]) // this will open the new page
* print driver.title \\ this prints the original title of the original URL
* switchPage('NewURL')
* delay(10000) // I've put this just in case but it doesn't work without it either
Then print driver.title // this still prints the original title of the original URL
任何帮助将不胜感激,我认为这是一个很棒的工具,但是在这种情况下我遇到了困难,我们的应用程序会为每个模块打开新的标签.
Any help would be really appreciated, I think it is a great tool but I'm having difficulty with this scenario and our application opens new tabs with every module.
谢谢
推荐答案
是的,我知道这可能很难.在0.9.6中,我们可以通过以下选项来切换标签:a)索引和b)该标签网址的子字符串
Yes I know this can be hard. In 0.9.6 we have an option to switch tab by a) index and b) sub-string of the URL of that tab
如果需要,请考虑提交一个简单的示例来帮助我们模拟和改进空手道: https://github.com/intuit/karate/tree/develop/examples/ui-test
Do consider submitting a simple example that can help us simulate and improve Karate if needed: https://github.com/intuit/karate/tree/develop/examples/ui-test
如果可能的话,我最后建议使用此选项.如果您有某种方法可以导出将打开的选项卡的URL,请尝试重新使用当前选项卡,从而简化测试.有关更多详细信息,请参见此线程: https://github.com/intuit/karate /issues/1269#issuecomment-682553602
Finally I recommend this option if possible. If there is some way for you to derive the URL of the tab that will get opened, try to re-use the current tab, and that makes for a simpler test. See this thread for more details: https://github.com/intuit/karate/issues/1269#issuecomment-682553602
这篇关于切换页面空手道UI问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!