Element is not found in Firefox even though it is definitely there

未关闭
#5,336 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
领域
testing-qa

调研方向

首先,使用 CodeceptJS 3.7.5、Webdriver 9.19.2 和 Firefox 重现所提供的 page-object 登录流程,并将点击账户图标进行导航与 I.amOnPage() 进行比较。针对 Chrome 和列出的 Firefox 版本,检查报告的 loginFormSelector (#LoginForm) 查找问题。完成标准是确定 Firefox 特有的失败原因,并确认可靠的修复或 workaround。

由索引模型根据 Issue 内容生成。

描述

stale

I've been facing the following problem for about a week without any updates to CodeceptJS (or other dependencies) or the application code.

  • test clicks on the account icon in the page header
  • login form opens
  • CodeceptJS should verify that a certain element exists
  • it doesn't find it within 10 seconds even though it's definitely there; in open mode I can see it and inspect the DOM and it's there
  • this happens 95% of time, very rarely it works
  • it worked fine until about a week ago

This is the login method in the page object. The selector it doesn't find is the loginFormSelector.

    login(email, password) {
        this.openLoginForm()
        this.fillLoginForm(email, password)
    }

    openLoginForm() {
        I.waitForClickable(this.navigationLinks.responsiveLogin, 10)
        I.click(this.navigationLinks.responsiveLogin)
        I.waitForElement(this.loginFormSelector, 10) // selector is '#LoginForm'
    }

    fillLoginForm(email, password) {
        I.fillField(this.customerData.loginCustomerEmail, email)
        I.click(this.buttons.loginSubmit)
    }

The HTML looks like this:

<div id="AccountLogin">
   <section>
      <section>...</section>
      <section id="LoginForm">
         <header>...</header>
         <form>...</form>
      </section>
   </section>
</div>

What found out so far:

  • no iframe
  • no shadow DOM
  • if I print the DOM with grabHTML in headless mode, the element is there
  • if I inspect the DOM in headed mode, the element is there
  • if I pause the test after it enters the login page, I can use I.seeElement in the terminal and it find the element, yet the test fails upon continuation

Does not help:

  • waitForVisible instead of waitForElement
  • upping the timeout to 20
  • adding a hard 3 second wait
  • using an older version of Firefox (I tried 145, 144 and 142)
  • running it locally or in the CI pipeline does not make a difference
  • using a different selector

Does help:

  • going to the login page by navigating to it with I.amOnPage() instead of clicking a link to get there
  • using Chrome instead of Firefox

CodeceptJS: 3.7.5
Webdriver: 9.19.2
Browser: Firefox 145 (and 144 and 142)

主要语言
JavaScript
星标
4.2k
派生
756
平均合并
2 天 9 小时
30 天内合并 PR
16

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

codeceptjs/CodeceptJS 的其他 Issue

查看 codeceptjs/CodeceptJS 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。