How to execute Chrome Recorder JSON export using Python pyppeteer

Running Chrome Recorder Scripts with Python

I have been working with Chrome’s built-in recorder tool and successfully created an automation recording. After finishing the recording session, I exported the data as a JSON file format.

My goal is to take this exported JSON recording and execute it programmatically using Python. I have been looking into the pyppeteer library which seems to be the most popular choice for browser automation in Python.

While I can write and run custom Python scripts for browser automation without any issues, I am specifically trying to figure out how to directly execute the JSON file that was generated by Chrome Recorder.

Has anyone found a way to parse and replay these Chrome Recorder JSON exports using pyppeteer or any other Python automation framework? I would appreciate any guidance on converting the recorded steps into executable Python code.

Chrome Recorder spits out JSON files using Chrome DevTools Protocol format, which doesn’t match pyppeteer’s API at all. Each step in the recording has type definitions, target selectors, and parameters you’ll need to decode. I’d build a mapping dictionary that translates Chrome Recorder actions into pyppeteer commands. Navigation events become await page.goto(), input actions turn into page.type() calls - just extract the selectors properly. Here’s what most people miss: Chrome Recorder captures real timing between actions. You need proper wait conditions with page.waitForSelector() or your playback will break. The JSON gives you multiple selector options for each step. Test different ones since Chrome Recorder often creates overly specific CSS selectors that won’t work across browsers.

I faced a similar issue previously. The Chrome Recorder exports its data in a format that aligns more with Puppeteer than pyppeteer, which can lead to confusion. The recorded steps include object types like ‘click’ or ‘change’, but translating these directly to pyppeteer commands requires a bit of tweaking. I created a function to parse the JSON output and convert each action into equivalent pyppeteer commands. For clicks, you have to extract the selector and use page.click() with that. Navigation steps translate to page.goto(). Keep in mind that Chrome Recorder might provide several selectors; I’ve found that using the first one is generally the safest option. Additionally, handling iframes necessitates extra care in pyppeteer, so plan for that.

for sure, the chrome recorder json is not gonna be used directly with pyppeteer. you gotta parse the json and turn it into pyppeteer commands, like using page.click() instead of just clicking. once u get the mapping, its not too hard. best of luck!