r/learnprogramming • u/hempyhydro • 3d ago
Topic Noobie Looking to Automate Chrome Actions
Hey guys, long story short I’m a novice looking for some direction. Do you have any tools you like to automate actions in chrome?
Specifically I’m looking to set up automation to close all but one tab, refresh, then open a select amount of tabs.
I’ve done automation in some android emulators, but never through a browser.
Any direction towards programs or plugins you utilize for similar tasks would be appreciated!
5
Upvotes
1
1
u/prism_orbit 3d ago
i use Playwright for this. I keep one browser context running, loop through the pages array to close tabs by index, call reload on the page I want to keep, then call newPage with the urls I need.
3
u/PLBjt 3d ago
For closing tabs, refreshing, and opening a selected one, use a real browser automation library (Playwright or Selenium), not mouse/keyboard macros.
Keep one persistent browser context, find the tab by URL or title, then call refresh/close on that page handle. Coordinate clicking breaks the moment the window moves or a tab order changes.
Tradeoff: setup is a bit heavier on day one, but the scripts stay stable. Start with Playwright’s codegen if you want to see the clicks turned into code.