Taiko: Object id doesn\'t reference a Node

Created on 19 May 2019  路  7Comments  路  Source: getgauge/taiko

Getting this exception while running the script given below

{ Error: Object id doesn't reference a Node
    at _enqueueCommand (/.../taiko/node_modules/chrome-remote-interface/lib/chrome.js:90:34)
    at Chrome._handleMessage (/.../taiko/node_modules/chrome-remote-interface/lib/chrome.js:252:17)
    at WebSocket._ws.on (/.../taiko/node_modules/chrome-remote-interface/lib/chrome.js:230:22)
    at WebSocket.emit (events.js:189:13)
    at Receiver.receiverOnMessage (/.../taiko/node_modules/ws/lib/websocket.js:789:20)
    at Receiver.emit (events.js:189:13)
    at Receiver.dataMessage (/.../taiko/node_modules/ws/lib/receiver.js:422:14)
    at perMessageDeflate.decompress (/.../taiko/node_modules/ws/lib/receiver.js:379:23)
    at _decompress (/.../taiko/node_modules/ws/lib/permessage-deflate.js:298:9)
    at _inflate.flush (/.../taiko/node_modules/ws/lib/permessage-deflate.js:376:7)
  request:
   { method: 'DOM.requestNode',
     params: { objectId: '{"injectedScriptId":1,"id":782}' } },
  response:
   { code: -32000, message: 'Object id doesn\'t reference a Node' } }

Steps to replicate

  • run the following script using taiko
const { browser, openBrowser, goto, click,link,image } = require('taiko');

(async () => {
    try {
        await openBrowser({headless:false});
        await goto("https://in.bookmyshow.com/bengaluru");

        await click("Bengaluru");
        await write('NCR', into(await inputField({"placeholder":"Search for your city"})));
        await click("NCR");
        await click("View All");
        await click(link("English"),below('Select Language'))
        await click(image(below(link("Now Showing"))))
        await click(link("Book Tickets"))

        await click(link({"class":"__showtime-link"}))
        await click("Accept")

        await click("Select Seats")
        await click(link(toRightOf("D")))

        // await click(link(contains("Pay ")))
        // await click(radioButton(toLeftOf(contains("M-Ticket"))))
    } catch (e) {
        await screenshot()
        console.error(e);
    } finally {
        await closeBrowser();
    }
})();

Version

commit 3bb2ade397840ad2326026bb7fad840161e673ea
Version: 0.8.0 (Chromium: 74.0.3723.0)
bug

All 7 comments

I'm facing the same issue

Error Message: Error: Object id doesn't reference a Node Stacktrace: Error: Object id doesn't reference a Node at _enqueueCommand (node_modules/chrome-remote-interface/lib/chrome.js:90:34) at Chrome._handleMessage (node_modules/chrome-remote-interface/lib/chrome.js:252:17) at WebSocket._ws.on (node_modules/chrome-remote-interface/lib/chrome.js:230:22) at WebSocket.emit (events.js:189:13) at Receiver.receiverOnMessage (node_modules/ws/lib/websocket.js:789:20) at Receiver.emit (events.js:189:13) at Receiver.dataMessage (node_modules/ws/lib/receiver.js:422:14) at perMessageDeflate.decompress (node_modules/ws/lib/receiver.js:379:23) at _decompress (node_modules/ws/lib/permessage-deflate.js:298:9)

This happens when clicking on a button that shows a loading icon before going to the next page

Also, I noticed taiko is not taking this instruction await text('M茅todo de pago').exists(timeoutSecs(20))

The workaround for me in the meantime is to use await waitFor(intervalSecs(5))

I can confirm the same issue with taiko v.7

A simple click("label") sometimes doesn't seem to work at all. Even using a selector doesn't select the expected element on the page.

I can also confirm that downgrading to v.6 everything seems now to be working fine again.

Fix should be available in commit 4d70983

This issue has been verified and tested against the commit: a622aa5c84bc8544ef3e3028ae73afcb55a96b1b

@Apoorva-GA I appreciate the fix but it could be improved. Commit 4d70983 addresses the issue by taking the first DOMRect out of the range.getClientRects() call but it does not address what happens if getClientRects() returns an empty collection, something that can and will happen if the target is an area tag or an element with display:none.

In that case a crash is definitely going to happen, since the following lines use the assigned value variable implying that it contains something.

More guards should be added to prevent addressing undefined values here.

Filtering of elements that are not visible are done when fetching the element itself, but agree there can be other scenarios where something can break. It is better to catch the error so that proper error message can be shown instead of Error: Object id doesn't reference a Node

@dmolin - The feedback is great, thank you! Just wanted to say that you are welcome to raise PRs too!

Was this page helpful?
0 / 5 - 0 ratings