Getting a panic error in test after clicking "Place order" button

I’m testing completed checkouts on a WooCommerce powered website (you can visit the example website by reviewing the script, linked at the bottom).

Had difficulty getting k6 to target the embedded iframes of the Braintree checkouts section, but finally cleared that hurdle.

The problem is after interacting with those two iframes, and then clicking on the Place order button (outside of those iframes) the test crashes within a couple seconds of that. I’ve tested different orders of operation to isolate exactly when the crash is happening (right after the page.screenshot on line 186 of my script).

I feel like the issue is that k6 is losing the context of the main page itself because of the iframe interactions but I can’t figure out a way to get it to not crash.

Here is the panic:

panic: GoError: dispose: disposing element with ID -1220096293751216353.29.1: Cannot find context with specified id (-32000)

Can’t embed the full trace because it’s seeing all the github mentions as URLs and I’m only allowed to post two apparently.

Link to the current script:

Hi @patricka1b8,

Apologies for the delay in getting back to you!

I’ve tried your script and at the moment I can’t seem to get past line 169 (const iframeHandle2 = page.waitForSelector('iframe[id*="braintree-hosted-field-expirationDate"]');), and it eventually times out looking for that selector. Do you know of anything has changed on your site?


Ankur, thanks so much for getting back to me!

Yes, because we were completely stalled we had to switch back to doing only a COD checkout within WooCommerce. I have switched it back to Braintree so you should be able to retest. Thanks! Let me know if there is anything I can do to help.

Hi @patricka1b8,

Ok, now it’s progressed to line 162 (const field1 = frame.waitForSelector("input[name='credit-card-number']");) but seems to be waiting indefinitely there (which isn’t good either).


I’m running the same test and I’m getting the kernel panic…

panic: GoError: dispose: disposing element with ID -2409315292900353541.29.1: Cannot find context with specified id (-32000)

running (00m47.8s), 20/20 VUs, 0 complete and 0 interrupted iterations

Could this be because I’m on a Mac/ARM ?

I will try to run this again on an Ubuntu 22.04 environment.

I’m taking a look at this. This might take me sometime but I’ll give you an update here.

There are two fixes to get your script to work. Both changes are currently in the following PRs:

  1. Fix execution context setting for iframes by ankur22 · Pull Request #1254 · grafana/xk6-browser · GitHub
  2. Investigate dispose context canceled by ankur22 · Pull Request #1261 · grafana/xk6-browser · GitHub

When combined I was able to run the test successfully with no errors or test aborts.

I’m hoping this will be part of the next release in the coming month.