While trying to move away from seleniumwire, I first tried Playwright (aggressively focused on "user testing" to the exclusion of automation), then nodriver (ran into obvious fatal bugs), and now I'm trying to use zendriver.
The problem is, as I'm trying to implement various things that I need for my application, including interception with the goal of aggressive caching, and now passkeys, I keep running into situations where as I work on a given CDP command via send(), the browser will simply vanish without warning and my code will continue on as if nothing happened. There are clearly issues in how I'm constructing the CDP commands, but there are no error messages, exceptions, or anything else coming from Zendriver to either tell me there's a problem, or help me debug it.
Right now I'm trying to use web_authn.add_credential, and as part of my debugging I've added a print(tx.message) in Connection.send() right before it goes to the websocket, and it's not even getting that far:
auth_id = await page.send(cdp.web_authn.add_virtual_authenticator(...))
print(auth_id)
print("before add_credential")
await page.send(cdp.web_authn.add_credential(authenticator=auth_id, credential=cred)
print("after add_credential")
await page.sleep(10)
What I get from this is:
->CDP {"method": "WebAuthn.addVirtualAuthenticator", "params": {"options": { "protocol": "ctap2" ...........
c7ce1845-8caf-4877-bdd3-22e03d3a7971
before add_credential
->CDP: {"method": "Browser.close", "params": [], "id": 5}
**EOF**
It appears that the add_credential call is literally screwing things up so badly that maybe an atexit() is triggering and closing the browser, or ....?
My previous descent down this rabbithole was for the add_virtual_authenticator call, when various code snippets indicated that I should have protocol="ctap2" rather than protocol=cdp.web_authn.AuthenticatorProtocol.CTAP2 (that's a whole other thing that should be fixed...). In chasing through the code, I localized it to the VirtualAuthenticatorOptions.to_json() call, which was blindly calling self.protocol.to_json() on what turned out to be a string rather than an AuthenticatorProtocol object. This obviously would throw an exception, except I never actually got an exception from anywhere, it just did the same thing of crashing out the browser and moving on as if nothing happened, until the next call in my code tried to talk to the browser and failed.
I'm going to try to dig into this and figure out exactly where this particular call is going wrong, and I'm going to try to figure out why it just silently fails.
To be continued...
While trying to move away from seleniumwire, I first tried Playwright (aggressively focused on "user testing" to the exclusion of automation), then nodriver (ran into obvious fatal bugs), and now I'm trying to use zendriver.
The problem is, as I'm trying to implement various things that I need for my application, including interception with the goal of aggressive caching, and now passkeys, I keep running into situations where as I work on a given CDP command via send(), the browser will simply vanish without warning and my code will continue on as if nothing happened. There are clearly issues in how I'm constructing the CDP commands, but there are no error messages, exceptions, or anything else coming from Zendriver to either tell me there's a problem, or help me debug it.
Right now I'm trying to use
web_authn.add_credential, and as part of my debugging I've added aprint(tx.message)inConnection.send()right before it goes to the websocket, and it's not even getting that far:What I get from this is:
It appears that the
add_credentialcall is literally screwing things up so badly that maybe an atexit() is triggering and closing the browser, or ....?My previous descent down this rabbithole was for the
add_virtual_authenticatorcall, when various code snippets indicated that I should haveprotocol="ctap2"rather thanprotocol=cdp.web_authn.AuthenticatorProtocol.CTAP2(that's a whole other thing that should be fixed...). In chasing through the code, I localized it to theVirtualAuthenticatorOptions.to_json()call, which was blindly callingself.protocol.to_json()on what turned out to be a string rather than anAuthenticatorProtocolobject. This obviously would throw an exception, except I never actually got an exception from anywhere, it just did the same thing of crashing out the browser and moving on as if nothing happened, until the next call in my code tried to talk to the browser and failed.I'm going to try to dig into this and figure out exactly where this particular call is going wrong, and I'm going to try to figure out why it just silently fails.
To be continued...