Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for text and xpath selectors #27

Open
jecfish opened this issue Oct 16, 2022 · 1 comment
Open

Add support for text and xpath selectors #27

jecfish opened this issue Oct 16, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@jecfish
Copy link
Contributor

jecfish commented Oct 16, 2022

DevTools Recorder support text and XPath selector from Chrome 108 onwards. I am wondering if there are similar selector in Nightwatch?

Here is the example step's json.

{
      "type": "click",
      "target": "main",
      "selectors": [
        [
          "aria/Proceed to checkout"
        ],
        [
          "[data-test=checkout]"
        ],
        [
          "xpath///*[@data-test=\"checkout\"]"
        ],
        [
          "text/Total: $0.00"
        ]
      ]
    }

Screen Shot 2022-10-16 at 9 35 19 AM

@nickserv
Copy link
Member

This recorder extension is designed to work with Jest and Vitest (soon), so we assume something like JSDOM is implementing DOM APIs. We could use document.evaluate to implement getElementByXpath, as long as the DOM implementation supports this. Otherwise, we could run tests directly in a real browser with something like Karma, Puppeteer, or Playwright.

@nickserv nickserv added the enhancement New feature or request label Oct 17, 2022
@nickserv nickserv changed the title Add support for text and xpath selector Add support for text and xpath selectors Jan 17, 2023
@nickserv nickserv moved this from Todo to In Progress in Testing Library Recorder Extension Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants