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

browsingContext.locateNodes causes Cannot convert undefined or null to object #2663

Open
christian-bromann opened this issue Oct 8, 2024 · 2 comments

Comments

@christian-bromann
Copy link
Contributor

The following browsingContext.locateNodes command causes an unexpected error. The payload is:

{
  "locator": {
    "type": "css",
    "value": "p"
  },
  "context": "9D759775E2DD1A3A0DF3F19F190FBB2A",
  "startNodes": [
    {
      "sharedId": "f.9D759775E2DD1A3A0DF3F19F190FBB2A.d.68270CA8749D6C7CD4AA73E22040C295.e.9"
    },
    {
      "sharedId": "f.9D759775E2DD1A3A0DF3F19F190FBB2A.d.68270CA8749D6C7CD4AA73E22040C295.e.11"
    },
    {
      "sharedId": "f.9D759775E2DD1A3A0DF3F19F190FBB2A.d.68270CA8749D6C7CD4AA73E22040C295.e.11"
    }
  ]
}

The error:

TypeError: Cannot convert undefined or null to object
    at Function.hasOwn (\u003Canonymous>)
    at WindowRealm.serializeForBiDi (\u003Canonymous>:517:1368)
    at WindowRealm.serializeForBiDi (\u003Canonymous>:549:1915)
    at WindowRealm.serializeForBiDi (\u003Canonymous>:517:1750)
    at WindowRealm.serializeForBiDi (\u003Canonymous>:549:1915)
    at WindowRealm.cdpToBidiValue (\u003Canonymous>:517:527)
    at WindowRealm.callFunction (\u003Canonymous>:517:6978)
    at async WindowRealm.callFunction (\u003Canonymous>:549:3531)
    at async #locateNodesByLocator (\u003Canonymous>:565:25244)
    at async BrowsingContextImpl.locateNodes (\u003Canonymous>:565:19734)

It seems like Chromedriver struggles if there are duplicate shared Ids.

@christian-bromann
Copy link
Contributor Author

I am getting another error for a simple lookup query:

2024-10-10T21:27:50.196Z INFO webdriver: BIDI COMMAND browsingContext.locateNodes {"locator":{"type":"css","value":"li"},"context":"BF44CEC775C51410E3C7088F35447BBB","startNodes":[{"sharedId":"f.BF44CEC775C51410E3C7088F35447BBB.d.61DA9EE30FB3CCA2EBEDC0274F4E18AE.e.8"},{"sharedId":"f.BF44CEC775C51410E3C7088F35447BBB.d.61DA9EE30FB3CCA2EBEDC0274F4E18AE.e.2"},{"sharedId":"f.BF44CEC775C51410E3C7088F35447BBB.d.61DA9EE30FB3CCA2EBEDC0274F4E18AE.e.6"}]}
2024-10-10T21:27:50.201Z DEBUG webdriver: BIDI RESULT {"error":"unknown error","id":20,"message":"Cannot convert undefined or null to object","stacktrace":"TypeError: Cannot convert undefined or null to object\n    at Function.hasOwn (\u003Canonymous>)\n    at WindowRealm.serializeForBiDi (\u003Canonymous>:517:1368)\n    at WindowRealm.serializeForBiDi (\u003Canonymous>:549:1915)\n    at WindowRealm.serializeForBiDi (\u003Canonymous>:517:1750)\n    at WindowRealm.serializeForBiDi (\u003Canonymous>:549:1915)\n    at WindowRealm.cdpToBidiValue (\u003Canonymous>:517:527)\n    at WindowRealm.callFunction (\u003Canonymous>:517:6978)\n    at async WindowRealm.callFunction (\u003Canonymous>:549:3531)\n    at async #locateNodesByLocator (\u003Canonymous>:565:25244)\n    at async BrowsingContextImpl.locateNodes (\u003Canonymous>:565:19734)","type":"error"}

@OrKoN
Copy link
Collaborator

OrKoN commented Oct 11, 2024

@christian-bromann are you sure the args are from the same realm? do you have an executable example to reproduce?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants