Playwright: WebKit: TypeError: $XPath is not a function. (In '$XPath(null, locator)', '$XPath' is "function $XPath(element, selector)

未关闭
#4,749 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
42/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
javascript, playwright
领域
testing

调研方向

使用 XPath 定位器,通过 CodeceptJS、Playwright 1.49.1、WebKit 以及所示的 I.waitForEnabled 和 I.click 调用重现该问题。首先跟踪 I.waitForEnabled 对 XPath 的处理及其对 page.waitForFunction 的调用;当定位器不再引发 $XPath TypeError 且可以点击已启用的按钮时,即表示完成。

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

描述

stale

Hello everyone,

I'm currently using codecept js Playwright(1.49.1) for testing and have the following code to click a button with a specific text:

I.waitForEnabled(locate('.RadioButton-caption').withText(`${option}`));
I.click(locate('.RadioButton-caption').withText(`${option}`));

I am running the test in WebKit, but I’m encountering the following error:

     element ({xpath: .//*[contains(concat(' ', normalize-space(./@class), ' '), ' RadioButton-caption ')][contains(., 'olyattest')]}) still not enabled after 10 sec
page.waitForFunction: TypeError: $XPath is not a function. (In '$XPath(null, locator)', '$XPath' is "function $XPath(element, selector) {
  const found = document.evaluate(selector, element || document.body, null, 5, null);
  const res = [];
  let current = null;
  while (current = found.iterateNext()) {
    res.push(current);
  }
  return res;
}")

It looks like I.waitForEnabled does not support xpath when running in webkit using playwright. Could you please fix it?

Thank you!

主要语言
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 摘要。