Skip to content

Using any proximity selector in Taiko 1.4.3/1.4.4 throws TypeError: Cannot read properties of undefined (reading '1') #2757

@sbehera1990

Description

@sbehera1990

Describe the bug
Using any proximity selector in Taiko 1.4.3/1.4.4 throws TypeError: Cannot read properties of undefined (reading '1')

To Reproduce
Steps (or script) to reproduce the behavior:
I am using gauge 1.6.14 and Taiko 1.4.3. The same code mentioned below used to work well with GUAGE1.5.7 and TAIKO 1.0.28.
After upgrading, it is throwing the above error TypeError: Cannot read properties of undefined (reading '1')
Create a step with any of the below code, it throws the above error.

assert.ok(await text(content1, toRightOf(content2)).exists());

or

assert.ok(await text(content1, toLeftOf(content2)).exists());

or

assert.ok(await text(content1, below(content2)).exists());

or

assert.ok(await text(content1, above(content2)).exists());

or

assert.ok(await text(expectedText, near(neighbourText)).exists());

Logs
26-08-2025 16:02:47.937 [Gauge] [ERROR] Stacktrace:
TypeError: Cannot read properties of undefined (reading '1')
at Object.getBoundingClientRect (node_modules\taiko\lib\handlers\domHandler.js:152:28)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async RelativeSearchElement.condition (node_modules\taiko\lib\taiko.js:2029:20)
at async RelativeSearchElement.validNodes (node_modules\taiko\lib\proximityElementSearch.js:65:11)
at async getMatchingNode (node_modules\taiko\lib\proximityElementSearch.js:30:28)
at async handleRelativeSearch (node_modules\taiko\lib\proximityElementSearch.js:13:25)
at async TextWrapper._get (node_modules\taiko\lib\elementWrapper\textWrapper.js:24:14)
at async node_modules\taiko\lib\elementSearch.js:358:22
at async waitUntil (node_modules\taiko\lib\helper.js:135:11)
at async node_modules\taiko\lib\elementSearch.js:356:7

Paste any log or error messages here

Expected behavior
All proximity selectors should work as expected.

Screenshots
Both the elements are getting highlighted as attached below, but not getting validated with the above code.

Image

Versions:

  • Taiko: 1.4.3
  • Gauge 1.6.14
  • OS Windows Server 2022 Standard
  • Node.js 22.16.0
gauge -v
Gauge version: 1.6.14
Commit Hash: 9561cf7

Plugins
-------
html-report (4.3.3)
java (0.8.1)
js (5.0.1)
screenshot (0.3.2)

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions