【问题标题】:Codeceptjs doesn't load most elements, waitForNavigation() just causes it to freeze foreverCodeceptjs 不会加载大多数元素,waitForNavigation() 只会导致它永远冻结
【发布时间】:2020-05-26 05:10:00
【问题描述】:

我在使用 codeceptjs 进行测试时遇到问题。我正在尝试在 Atlassian 云上测试应用程序,但 codeceptjs/puppeteer 无法与页面上的任何元素进行交互。当我启用屏幕截图时,我看到它在正确的页面上,但 codeceptjs 只能在导航菜单中找到元素。它甚至无法通过选择器或 xpath 找到正文元素。 我尝试添加I.waitForNavigation(),但测试从未超过该步骤。正如他们在文档here 中所说的那样,我尝试在配置部分设置超时,但我没有运气。我尝试了他们建议的一切,但它只是永远等在那里。如果我注释掉 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.

我不知道为什么会这样。非常感谢任何帮助。

【问题讨论】:

    标签: automated-tests qa codeceptjs


    【解决方案1】:

    amOnPage 使用默认配置运行导航并在导航后通过。

    waitForNavigation会在导航后开始等待导航。因此,如果您不再运行导航或页面重定向开始,它永远不会发生。

    你有两个选择:

    1. 不要使用waitForNavigation,只能使用amOnPage
    2. Promise.all中使用waitForNavigationamOnPageawait Promise.all(I.waitForNavigation(); I.amOnPage(pageUrl));

    【讨论】:

      猜你喜欢
      • 2020-10-24
      • 1970-01-01
      • 1970-01-01
      • 2015-04-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-19
      • 1970-01-01
      相关资源
      最近更新 更多