-
Notifications
You must be signed in to change notification settings - Fork 31
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
Get examples/cross-browser.py
to run on top of Firefox’s BiDi implementation
#110
Comments
@mathiasbynens this might be related to the host and origin header restrictions which have been discussed on the WebDriver BiDi issue tracker. There is w3c/webdriver-bidi#155 for getting it merged. Basically WebSocket clients should send an empty In case of a non-empty Please let me know if this is the issue. If not the stdout logging from Firefox will be very helpful. Maybe you could even set the |
I added some logging to my local
Successful connection (with Chromium BiDi):
Failed connection with Firefox:
The relevant difference is:
|
Interesting. We seem to return the wrong HTTP header here. But so far none of the WebSocket clients that we used actually run into this problem. I'll check that. Also I can see that you are using version 8.1 of websockets. But the latest release is 10.3. Maybe you could try again with that one in parallel? |
There is https://bugzilla.mozilla.org/show_bug.cgi?id=1766581 on file to get the HTTP response status fixed. |
@mathiasbynens actually we do send the correct response when the connection occurs for the correct client request which has to include the https://github.com/GoogleChromeLabs/chromium-bidi/blob/main/examples/cross-browser.py#L27 |
You can find the details in the WebDriver spec at https://w3c.github.io/webdriver-bidi/#transport under step 2. As such it looks like that Chrome requires a fix to not accept WebSocket connections for any URL (resource name). |
Per step 2 of https://w3c.github.io/webdriver-bidi/#transport, the endpoint is supposed to be `/session` and nothing else. Issue: #110
Per step 2 of https://w3c.github.io/webdriver-bidi/#transport, the endpoint is supposed to be `/session` and nothing else. Issue: #110
Per step 2 of https://w3c.github.io/webdriver-bidi/#transport, the endpoint is supposed to be `/session` and nothing else. Issue: #110
Per step 2 of https://w3c.github.io/webdriver-bidi/#transport, the endpoint is supposed to be `/session` and nothing else. Issue: #110
Per step 2 of https://w3c.github.io/webdriver-bidi/#transport, the endpoint is supposed to be `/session` and nothing else. Issue: #110
Per step 2 of https://w3c.github.io/webdriver-bidi/#transport, the endpoint is supposed to be `/session` (with an optional query string attached to it). Issue: #110
Per step 2 of https://w3c.github.io/webdriver-bidi/#transport, the endpoint is supposed to be `/session` (with an optional query string attached to it). Issue: #110
@mathiasbynens so I assume that this issue is fixed when using the right end-point? Or is something else not working yet? |
@whimboo Not fully fixed yet, but it got us further along for sure: $ PORT=9222 python3 examples/cross-browser.py # Firefox
Using selector: KqueueSelector
client - state = CONNECTING
client - event = connection_made(<_SelectorSocketTransport fd=8 read=idle write=<idle, bufsize=0>>)
client > GET /session HTTP/1.1
client > Headers([('Host', 'localhost:9222'), ('Upgrade', 'websocket'), ('Connection', 'Upgrade'), ('Sec-WebSocket-Key', 'Q1p4Y7uTFZRGFAStdtJNFg=='), ('Sec-WebSocket-Version', '13'), ('Sec-WebSocket-Extensions', 'permessage-deflate; client_max_window_bits'), ('User-Agent', 'Python/3.9 websockets/8.1')])
client - event = data_received(<166 bytes>)
client < HTTP/1.1 101 Switching Protocols
client < Headers([('Server', 'httpd.js'), ('Upgrade', 'websocket'), ('Connection', 'Upgrade'), ('Sec-WebSocket-Accept', 'tLxRXEQ8lRBaUuVA/exKJ2v0g10='), ('Content-Length', '0')])
client - state = OPEN
client > Frame(fin=True, opcode=1, data=b'{"id": 1000, "method": "browsingContext.create", "params": {}}', rsv1=False, rsv2=False, rsv3=False)
client - event = data_received(<653 bytes>)
client < Frame(fin=True, opcode=1, data=b'{"id":1000,"error":"invalid session id","message":"WebDriver session does not exist, or is not active","stacktrace":"WebDriverError@chrome://remote/content/shared/webdriver/Errors.jsm:183:5\\nInvalidSessionIDError@chrome://remote/content/shared/webdriver/Errors.jsm:354:5\\nassert.that/<@chrome://remote/content/shared/webdriver/Assert.jsm:445:13\\nassert.session@chrome://remote/content/shared/webdriver/Assert.jsm:43:4\\nonPacket@chrome://remote/content/webdriver-bidi/WebDriverBiDiConnection.jsm:172:16\\nonMessage@chrome://remote/content/server/WebSocketTransport.jsm:89:18\\nhandleEvent@chrome://remote/content/server/WebSocketTransport.jsm:71:14\\n"}', rsv1=False, rsv2=False, rsv3=False)
Traceback (most recent call last):
File "~/projects/chromium-bidi/examples/cross-browser.py", line 159, in <module>
result = loop.run_until_complete(main())
File "~/homebrew/Cellar/[email protected]/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "~/projects/chromium-bidi/examples/cross-browser.py", line 89, in main
context_id = command_result['result']['context']
KeyError: 'result' This is likely because we’re hardcoding things like command IDs in this repo, e.g. chromium-bidi/examples/cross-browser.py Lines 66 to 69 in 93bcca5
|
Note that Note that there is also another problem when sending commands other than |
Also the visible failure is |
@whimboo Thanks. With the changes in #119, we’re making progress towards running the complete example in Firefox. (We still have to implement
I’ll subscribe to https://bugzilla.mozilla.org/show_bug.cgi?id=1750541 for updates. |
That is a bit more complicated. It's not a command that you will get pretty soon (see bug 1750541). It's on our list for the next milestone but will be blocked by the implementation of Maybe we can get an example working that uses the logging events? Looks like the relevant PR for chromium-bidi is also close to get landed. |
FWIW: I added script using Meaning the issue can be closed after |
That sounds good! We will start soon on |
With Firefox Nighty:
We should figure out what’s going on here.
The text was updated successfully, but these errors were encountered: