Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
browser automation

How to Automate Browser Actions in Chrome: Extensions, Playwright, Selenium and CDP

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a Chrome extension when automation must run in the user’s open browser, Playwright or Selenium for repeatable end-to-end workflows, and the Chrome DevTools Protocol (CDP) for low-level inspection and control. The safest implementation starts by defining the visible outcome, selecting the least powerful route that can achieve it, granting only necessary permissions, and replacing timing guesses with explicit waits and user-facing assertions.

Choose the right Chrome automation route

These approaches solve different problems. An extension executes inside Chrome and can react to the page a person is viewing. Playwright and Selenium run from a separate test or control process that launches or attaches to Chrome. CDP exposes browser-level instrumentation such as network, DOM, debugging and performance domains.

Route Execution context Best for Main trade-off
Chrome extension Inside the installed browser User-facing enhancements, page helpers and workflows triggered by a person Permission, review and data-disclosure responsibilities
Playwright Separate Node.js, Python, Java or .NET process Repeatable end-to-end tests, screenshots, multiple contexts and reliable locators Requires a test runner or service process
Selenium Separate WebDriver client and browser driver Established WebDriver automation and cross-browser suites More driver and synchronization configuration
CDP Direct protocol connection to Chromium Network inspection, debugging, profiling and specialized browser control Low-level commands require more code and browser-specific knowledge

Chrome’s extension-testing guidance lists Playwright, Puppeteer and Selenium as supported libraries. Playwright connects to Chromium-based browsers through CDP when needed, while Selenium supports WebDriver and WebDriver BiDi, the W3C bidirectional browser-automation protocol.

Build an extension for automation inside the user’s Chrome

Content scripts are files that run in the context of web pages. They can read and change the DOM, but privileged extension APIs belong to the extension’s service worker or other extension contexts. Message passing connects the two.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

1. Declare the narrowest permissions

Create a directory with a Manifest V3 file. Use activeTab for a user-invoked action when possible; otherwise specify only the host patterns the feature truly needs. Optional permissions can defer access until the user enables a feature.

{
  "manifest_version": 3,
  "name": "Form helper",
  "version": "1.0.0",
  "action": { "default_title": "Fill demo form" },
  "permissions": ["activeTab", "scripting"],
  "background": { "service_worker": "service-worker.js" },
  "content_scripts": [{
    "matches": ["https://app.example.com/*"],
    "js": ["content.js"]
  }]
}

In Chrome, open chrome://extensions, enable Developer mode, choose Load unpacked, and select the directory. Keep the match pattern narrow rather than requesting access to every site.

2. Keep page work in the content script

// content.js
function fillForm() {
  const email = document.querySelector('input[name="email"]');
  const submit = document.querySelector('button[type="submit"]');
  if (!email || !submit) return { ok: false, reason: 'form-not-found' };
  email.focus();
  email.value = '[email protected]';
  email.dispatchEvent(new Event('input', { bubbles: true }));
  submit.click();
  return { ok: true };
}

chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
  if (message.type === 'fill-form') sendResponse(fillForm());
  return true;
});

3. Route privileged work through the service worker

// service-worker.js
chrome.action.onClicked.addListener(async (tab) => {
  if (!tab.id) return;
  const result = await chrome.tabs.sendMessage(tab.id, { type: 'fill-form' });
  console.log(result);
});

For a script that is not permanently injected, replace the message call with chrome.scripting.executeScript after checking the active tab and required permission. Never put secrets in a content script: page JavaScript and injected code are exposed to the page’s security boundary.

Rank #2
acer AKB910 Wired USB Keyboard – Compact Design, Full-Size Keys, Chrome OS Compatible, Black
  • Full-Size Layout – Enjoy comfortable typing with well-spaced keys in a compact design.
  • Plug-and-Play USB – Quick and easy setup; no drivers or software required.
  • Chrome OS Compatible – Perfect for Acer Chromebooks and other Chrome OS devices.
  • Durable Build – Designed for long-lasting performance with quality materials.
  • Universal Support – Works with Windows, Chrome OS, and most USB-enabled devices.

Automate Chrome with Playwright

Playwright is usually the shortest path to a repeatable workflow. Install it with npm install -D playwright and download its browser binaries with npx playwright install chromium. The following complete Node.js example creates a deterministic page, fills a field, clicks, waits for a visible result and takes a screenshot.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch({ headless: true });
  const page = await browser.newPage({ viewport: { width: 1280, height: 800 } });
  await page.setContent(`
    <form id="demo">
      <label>Email <input name="email" /></label>
      <button type="submit">Continue</button>
      <p id="status" hidden>Submitted</p>
    </form>
    <script>
      demo.addEventListener('submit', e => {
        e.preventDefault(); status.hidden = false;
      });
    </script>`);
  await page.getByLabel('Email').fill('[email protected]');
  await page.getByRole('button', { name: 'Continue' }).click();
  await page.getByText('Submitted').waitFor({ state: 'visible' });
  await page.screenshot({ path: 'result.png', fullPage: true });
  await browser.close();
})();

Use locators and explicit waits

Prefer labels, roles and other user-facing locators over generated CSS classes or XPath tied to implementation details. Wait for a selector, URL change or visible state that represents success. A fixed delay can hide a race: the page may be slower than the delay, or the delay may waste time when it is already ready. For pages that load data after navigation, wait for the relevant response or element rather than assuming network idle means the application is usable.

Automate Chrome with Selenium

Selenium uses a WebDriver client. Install the Python package with python -m pip install selenium. Recent Selenium versions can manage a compatible Chrome driver automatically in common environments.

Rank #3
Brydge C-Type
  • Chrome Keyboard - The first dedicated desktop wireless keyboard for Chrome OS anywhere. Whether it's your Chromebook, Chrome Box or Chrome OS based Tablet, the streamlined design of the C-Type, Aluminium housing and key frame give you the best of Chrome OS. Will not work with Windows
  • Award Winning BLUETOOTH Keyboard - As an industry-leading wireless bluetooth keyboard for Chrome OS, C-Type will provide a unique typing experience. The C-Type is carefully designed to fit the iPad perfectly in size, color, and material. The full iPad keyboard with Chrome exclusive function keys and shortcuts like the Google Assistant Key will give you the ultimate functionality and productivity.
  • DELICATE DESIGN - Forged from a single piece of high quality aluminum, Brydge Type C is designed to give you a true premium standalone wireless keyboard for Chrome OS. Versatile bluetooth keyboard design brings functionality and productivity to your fingertips with tactile keys. LED lighting is not included.
  • DUAL CONNECTION - With USB-C and Bluetooth 4.1 capability, Brydge C-Type can connect to your desktop or experience wireless typing using Bluetooth 4.1. Bluetooth 4.1 provides high connectivity and longer battery life to ensure your keyboard lasts 6 months.
  • LIFETIME WARRANTY AND SUPPORT: Brydge takes pride in the quality of its products and you can rest assured that our products will stand the test of time and normal usage. Trust yourself. All Brydge products come with a Limited Lifetime Warranty and free customer support based in Park City, Utas.
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

options = webdriver.ChromeOptions()
options.add_argument('--headless=new')
driver = webdriver.Chrome(options=options)
try:
    driver.get('data:text/html,<form id="f"><label>Email <input name="email"></label><button type="submit">Continue</button><p id="status" hidden>Submitted</p></form>')
    driver.find_element(By.NAME, 'email').send_keys('[email protected]')
    driver.find_element(By.CSS_SELECTOR, 'button[type="submit"]').click()
    WebDriverWait(driver, 10).until(
        EC.visibility_of_element_located((By.ID, 'status'))
    )
    driver.save_screenshot('result.png')
finally:
    driver.quit()

For production suites, isolate each test in a fresh browser context or profile, clear state deliberately, and collect browser logs and screenshots on failure. Selenium’s BiDi APIs are useful when you need bidirectional events rather than only request-and-response WebDriver commands.

Use CDP when you need browser-level control

CDP is the low-level interface for instrumenting, inspecting, debugging and profiling Chromium and other Blink-based browsers. Start Chrome with a debugging endpoint, then connect with a CDP-capable library. Use it for tasks such as observing network requests, enabling performance domains, reading console events or issuing protocol commands unavailable through a higher-level locator API.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
google-chrome --headless=new --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-automation

Do not expose the debugging port to an untrusted network. Anyone who can reach it may control the browser and access its data. Prefer a loopback bind, an isolated profile and a short-lived process. In an extension, the higher-level chrome.debugger API provides access to selected CDP functionality, subject to extension permissions.

Rank #4
Rii RK903 Wireless Keyboard Mouse Combo,Full Size Keyboard with Scroll Wheel,1000 DPI Mouse,2.4G Wireless,Compatible with Windows Chrome OS Linux,for Home,Office,Business Users
  • Full-Size Keyboard with Volume Scroll Wheel:This wireless keyboard mouse combo features a full-size keyboard with a dedicated scroll wheel for easy volume adjustment
  • Stable Connectivity:The wireless keyboard and mouse set uses 2.4G USB wireless for stable connection.Plug-and-play design needs no extra drivers,great for document editing, web browsing and daily office tasks on desktops and laptops
  • 1000 DPI Optical Mouse:This combo comes with a 1000 DPI mouse for accurate,responsive control.It offers smooth tracking and clicking,ideal for long-hour office work,data entry and daily computing tasks
  • Wide Compatibility:The wireless keyboard mouse combo supports Windows,Chrome OS and Linux OS.It works with most desktops and laptops,suitable for home offices, business workstations and study spaces
  • Ergonomic Design:Users Designed for daily office use, this full-size combo ensures comfortable long-hour typing.Durable and user-friendly, it fits well in offices,home work areas and study environments

Make workflows reliable and safe

Define a visible success condition

Write down the exact user-visible result before coding: a confirmation message, URL, downloaded file, changed row or screenshot. Assert that result after the action. Chrome recommends integration tests based on what a user can see rather than internal extension state.

Control state and data

  • Use a dedicated Chrome profile or incognito context for tests so cookies and local storage do not leak between runs.
  • Inject only test credentials and keep secrets in environment variables or a secret manager, never in page scripts or source control.
  • Redact sensitive values from traces, screenshots and logs.
  • Use test accounts and staging domains for destructive actions. Add a confirmation gate before purchases, deletions or messages.

Minimize extension exposure

Chrome Web Store policy requires the narrowest permissions necessary. Browsing activity and page content are user data; collection and transmission must be limited to the disclosed single purpose, including when processing is local. Explain what the extension reads, where data goes and how long it is retained. Transmit sensitive information securely, publish an accurate privacy policy when user data is handled, and do not ship remote executable logic unless it is covered by a permitted, documented API.

Troubleshoot common failures

Symptom Likely cause Fix
“Cannot access contents of the page” in an extension The match pattern or permission does not cover the tab, or the page is a restricted Chrome URL. Request only the required host permission or use activeTab after a user action. Chrome internal pages and the Web Store cannot be automated like normal sites.
Element not found The element is inside an iframe, shadow root, or has not rendered yet. Select the correct frame, use a shadow-root-aware locator, and wait for a meaningful visible state.
Click has no effect An overlay intercepts the click, the control is disabled, or the application listens for a different event. Wait for the control to be enabled and visible, dismiss the overlay through the UI, and use the framework’s normal click rather than forcing JavaScript unless you have verified the page’s event model.
Flaky timeout A fixed sleep races network or client-side rendering. Wait for a selector, response, URL or assertion tied to the action. Capture a screenshot, DOM snapshot and console log on failure.
Chrome or driver version error The WebDriver, browser or attached CDP endpoint is incompatible. Use a supported browser/driver pairing, let Selenium manage the driver where available, or connect Playwright/CDP to the exact Chromium instance you launched.
Automation stops at a CAPTCHA or bot check The site is deliberately challenging automated access. Do not attempt to defeat the challenge. Use an approved test environment, a documented API or a manual handoff, and respect the site’s terms.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is a clean page image or PDF rather than clicking through an interactive workflow, ScreenshotNeo provides a single HTTP request. Before capture it accepts cookie/consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups and chat widgets; each cleanup step can be disabled. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and response headers report the page verdict and billing result.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read the parameter reference in the ScreenshotNeo documentation. cURL:

Best Value
2-Pack Chrome OS Reference Keyboard Shortcuts Sticker - Universal Shortcut Reference Decal for Any Brand Chromebook Laptop Running Chrome OS
  • Quick Reference: Durable vinyl sticker provides a handy reference for Chromebook keyboard shortcuts like Ctrl+T, Alt+Tab and more right on your keyboard.
  • Fits Most Chromebooks: The sticker is designed to fit 11.6"-15.6" Chromebook keyboards for easy accessibility of shortcuts.
  • High Quality Material: Made of environmental vinyl designed for long-lasting use, the sticker won't fade or peel like cheap paper stickers.
  • Easy to Apply and Remove: Precut for a perfect fit, the adhesive backing allows for simple, mess-free application and removal without damaging your Chromebook.
  • 2 Pack Included: Get an extra sticker for your Chromebook or as a backup, so you'll always have a shortcuts reference close at hand.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
const file = Buffer.from(await res.arrayBuffer());
require('fs').writeFileSync('shot.webp', file);

ScreenshotNeo supports PNG, JPEG, WebP and PDF output; full-page capture with lazy images loaded; CSS-selector element capture; dark mode; 12 device presets plus custom viewports; retina scale; PDF paper size, margins, landscape and page ranges; custom CSS and JavaScript; pre-capture clicks; hidden selectors; waits for selectors, delays or network idle; ad, tracker, request and resource blocking; custom headers, cookies, user agents and Authorization; timezone and geolocation; transparent backgrounds; image resizing; user-selected cache TTLs; signed links for public <img> tags; asynchronous jobs with signed webhooks; bulk capture of up to 100 URLs per call; a usage API and OpenAPI specification. Common parameter names used by other screenshot APIs also work, easing migration. Its MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients.

Plan Included shots Price
Free 1,000 per month $0, no card
Starter 3,000 $5
Growth 15,000 $15
Pro 60,000 $39
Scale 250,000 $99
Business 1,000,000 $249

Every feature is available on every plan, and yearly billing gives two months free. Create a free ScreenshotNeo account to get 1,000 screenshots each month with no card; paid plans start at $5 for 3,000.

Frequently asked questions

Can Chrome automation run without an extension?

Yes. Playwright, Selenium and CDP run as external processes and do not require installing an extension in the target Chrome profile.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Should I choose Playwright or Selenium?

Choose Playwright for modern locator and waiting ergonomics in a repeatable test process. Choose Selenium when your organization already standardizes on WebDriver or needs its established ecosystem and BiDi protocol.

Can an extension read every website?

Only with matching host access and the user’s approval, and some Chrome-internal pages are restricted. Requesting broad access also creates greater privacy, review and security obligations.

Is CDP a replacement for Playwright?

No. CDP is a protocol layer. Playwright can use CDP while providing higher-level navigation, locators, assertions, contexts and screenshots; use direct CDP when protocol-level instrumentation is the requirement.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.