w3c / webdriver-bidi

Bidirectional WebDriver protocol for browser automation
https://w3c.github.io/webdriver-bidi/
336 stars 35 forks source link

Make it possible to deserialize `WindowProxy` using context id #594

Open lutien opened 8 months ago

lutien commented 8 months ago

Right now, we can only deserialize WindowProxy using handle but when we serialize it we get back context id which we could use for deserialization. In the other words, this issue is about making it possible to send as a script argument a value {context: "foo", type: "window"} and have it resolve to the current WindowProxy in that navigable.

jgraham commented 8 months ago

So this is basically saving a roundtrip / race vs (pseudocode):

fn call_function_with_window(function) {
  window_handle = script.evaluate("window", context)
  assert window_handle.context == context
  script.call_function(function, [window_handle.handle], context)
}