我在使用codeceptjs进行测试时遇到问题。我正在尝试在Atlassian云上测试应用程序,但codeceptjs / puppeteer无法与页面上的任何元素进行交互。当我启用屏幕截图时,我会在右页上看到它,但是codeceptjs只能在导航菜单中找到元素。它甚至无法通过选择器或xpath找到body元素。我尝试添加I.waitForNavigation()
,但测试从未超过该步骤。正如他们在文档here中所说的,我试图在config部分设置超时,但是我没有运气。我尝试了他们提出的所有建议,但它一直在那里等待着。如果我注释掉I.waitForNavigation()
,它将失败,因为它找不到Boyd元素。我正在使用在目录中安装codeceptjs时创建的默认配置文件。这是我尝试测试的代码,但它会引起各种问题。
I.amOnPage('https://artemis-test2.atlassian.net/wiki/plugins/servlet/ac/com.nurago.confluence.plugins.treecopy/copy-page-tree-confluence?page.id=25821196&space.key=TEST1');
I.waitForNavigation();
// if I don't comment this out it will wait here forever
I.wait(4);
I.waitForElement('.ap-iframe');
// it can find the iframe for some reason but nothing else
I.waitForElement('.body');
// if I do comment it out it fails here because it says there is no body element. can't find it by xpath either.
我不知道为什么会这样。任何帮助,我们将不胜感激。
[amOnPage
,默认配置,运行导航并在导航后通过。
waitForNavigation
将在导航后开始等待导航。因此,如果您不会再次运行导航或启动页面重定向,就永远不会发生。
您有2个选择:
waitForNavigation
,仅使用amOnPage
。waitForNavigation
内的amOnPage
和Promise.all
:await Promise.all(I.waitForNavigation(); I.amOnPage(pageUrl));