How to run/deploy playwright on Heroku?

Photo by Roman Synkevych on Unsplash

To start with what is playwright? Its a framework to enable end-2-end testing for web apps. But its not the only use case of playwright. Web scraping is also another use case we can use it for.

Doing scraping is very easy with playwright as it gives you an option where you can navigate through the workflow and it will generate the code for you. There are many languages support for that.

you can get started with with the below command npx playwright codegen <url> . This will open the url entered and the playwright inspector and one has many options to select the language of choice code.

In the above example I opened google and searched javascript and one the right hand side it generated code for that. Like this one can generate the code quickly.

Fast forward if you deploy the code on heroku. It fails to recognize the playwright package. As many I tried many different options and nothing worked until I found this stack overflow link.

All one has to do is add the playwright build pack. To run the playwright on Heroku the container needs the right build pack and order matters. Make sure its first and then running environment. In my case its node.

My app is exposed as an API and now I can use the playwright capabilities. Let me know if you have questions I am happy to help. Happy learning happy coding.




#IBMER #JS-Advocate #SoftwareEngineer #TechnologyLover #Learner #intermediatetennisplayer #lifebetweenthebraces{}

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

GSOC’20 Weekly Updates

All you need to know about ReactJS

Tutorial: Redux and React-Redux from Scratch

React-Redux Boilerplate with Best Practices

HTML5 Canvas Text

Form Cu

3 Essential JavaScript Array Functions You Should Know


Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Akshay Mattoo

Akshay Mattoo

#IBMER #JS-Advocate #SoftwareEngineer #TechnologyLover #Learner #intermediatetennisplayer #lifebetweenthebraces{}

More from Medium

Journey of DLithe Bootcamp .NET Full Stack Week 2(Jan31-Feb5)

To-do Project

Uploading files directly to MongoDB, Hands on with a simple VueJS App

WebdriverIO Automation Framework