codeceptjs / codeceptjs/CodeceptJS

DOMException thrown with using text locators with puppeteer click method

Open
#1,787 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
4.2k
Forks
757
Avg merge
2d 9h
Merged PRs (30d)
16

Description

#### What are you trying to achieve?

Test clicking on element found by text (fuzzy selector).

#### What do you get instead?

When testing click behavior using latest Puppeteer driver, the exception is thrown:
`DOMException: Failed to execute 'querySelectorAll' on 'Element': 'Computer & Data (160)' is not a valid selector.`

The same test is working correctly with Webdriver.

> Provide console output if related. Use `--verbose` mode for more details.

```bash
Error: Evaluation failed: DOMException: Failed to execute 'querySelectorAll' on 'Element': 'Computer & Data (160)' is not a valid selector.
at __puppeteer_evaluation_script__:1:33
at ExecutionContext._evaluateInternal (node_modules/puppeteer/lib/ExecutionContext.js:122:13)
at process._tickCallback (internal/process/next_tick.js:68:7)
-- ASYNC --
at ExecutionContext. (node_modules/puppeteer/lib/helper.js:111:15)
at ElementHandle.$$ (node_modules/puppeteer/lib/JSHandle.js:411:55)
at ElementHandle. (node_modules/puppeteer/lib/helper.js:112:23)
at Puppeteer.findElements (node_modules/codeceptjs/lib/helper/Puppeteer.js:2035:42)
at Puppeteer.findClickable (node_modules/codeceptjs/lib/helper/Puppeteer.js:2082:23)
at process._tickCallback (internal/process/next_tick.js:68:7)
```

> Provide test source code if related

```js
...
I.click('Computer & Data (160)')
...
```

### Details

* CodeceptJS version: 2.2.0
* NodeJS Version: v10.15.3
* Operating System: macOS 10.14.5
* Puppeteer: 1.18.1,
* Configuration file:

```js
...
helpers: {
Puppeteer: {
url: process.env.BASE_URL,
show: true,
windowSize: '1920x1080',
chrome: {
args: ['--no-sandbox', '--window-size=1920,1080']
}
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.