getgauge / taiko

A node.js library for testing modern web applications
https://taiko.dev
MIT License
3.57k stars 453 forks source link

Could not compute content quads error is displayed sometimes when working with exists(0,0) #2615

Closed gokultw closed 1 month ago

gokultw commented 2 years ago

Describe the bug Could not compute content quads error is displayed sometimes when working with exists(0,0)

To Reproduce Below code some time throwing error Could not compute content quads

await text("SOME_TEXT").exists(0,0);

Logs

Error: Could not compute content quads.
    at node_modules/chrome-remote-interface/lib/chrome.js:94:35
    at Chrome._handleMessage (node_modules/chrome-remote-interface/lib/chrome.js:257:17)
    at WebSocket.<anonymous> (node_modules/chrome-remote-interface/lib/chrome.js:235:22)
    at WebSocket.emit (node:events:527:28)
    at Receiver.receiverOnMessage (node_modules/ws/lib/websocket.js:1059:20)
    at Receiver.emit (node:events:527:28)
    at Receiver.dataMessage (node_modules/ws/lib/receiver.js:517:14)
    at node_modules/ws/lib/receiver.js:468:23
    at node_modules/ws/lib/permessage-deflate.js:308:9
    at node_modules/ws/lib/permessage-deflate.js:391:7
    at afterWrite (node:internal/streams/writable:497:5)
    at onwrite (node:internal/streams/writable:477:7)
    at Zlib.cb (node:internal/streams/transform:202:7)
    at Zlib.processCallback (node:zlib:611:8)

Expected behavior Exists(0,0) should return true or false based on element existence.

Taiko: 1.4.3 OS: MAC Os 12.4 Node.js: v14.19.1 Gauge version: 1.4.3

gokultw commented 2 years ago

got this error for .text() method as well.

mschaaf commented 1 year ago

We run into the same error and I applied a small change to taiko/lib/handlers/domHandler.js that allows the test suite to finish. We changed the getBoxModel function so that it returns default coordinates.

async function getBoxModel(e) {
  try {
  let result = await dom.getContentQuads({
    objectId: isElement(e) ? e.objectId : e,
  });
  return { model: { border: result.quads[0] } };
  } catch (e) {
    return {model: { border: [0,0, 0,0, 0,0, 0,0]}};
  }
}

I don't know why it happens and for what object and whether it is a bad idea to solve it like this or not. But I can tell that it solves the issue for us.

gokultw commented 1 year ago

@saikrishna321, could you please help here?

gokultw commented 1 month ago

@zabil is this fixed?

zabil commented 1 month ago

The libraries and browser versions have been upgraded since this issue was reported. Happy to re-open If it's still a problem and there's a proper script to replicate it.