ระบบอัตโนมัติ
Puppeteer และ Playwright ต่อตรงเข้าโปรไฟล์ของคุณ
ทุกโปรไฟล์ที่เปิดอยู่มีที่อยู่สำหรับดีบักของตัวเอง เชื่อมโค้ดของคุณเข้ากับโปรไฟล์นั้นได้เลย พร้อมลายนิ้วมือ คุกกี้ และพร็อกซีของมันเอง รวมอยู่ในทุกแพ็กเกจ รวมถึงแบบฟรี
- 1เปิดใช้อินเทอร์เฟซในเครื่องจากโปรแกรม: ตั้งค่า หัวข้อ «Local API» แล้วคัดลอกกุญแจ
- 2สั่งให้เปิดโปรไฟล์ คำตอบจะเป็นที่อยู่ซึ่งเป็นของโปรไฟล์นั้นเท่านั้น
- 3เชื่อมโค้ดของคุณเข้ากับที่อยู่นั้นเหมือนเชื่อมกับเบราว์เซอร์ธรรมดา
- 4ทำงานตามปกติ ลายนิ้วมือ คุกกี้ และพร็อกซีพร้อมอยู่แล้ว
JavaScript (puppeteer-core)
const puppeteer = require('puppeteer-core');
(async () => {
// 1. Ask the app for this profile's debugging endpoint.
const started = await fetch(
'http://127.0.0.1:50325/api/v1/browser/start?profileId=YOUR_PROFILE_ID',
{ method: 'POST', headers: { 'x-api-token': 'YOUR_API_TOKEN' } },
).then((r) => r.json());
// 2. Attach to it like to any other browser.
const browser = await puppeteer.connect({
browserWSEndpoint: started.data.ws,
defaultViewport: null,
});
const [page] = await browser.pages();
await page.goto('https://example.com');
})();
Python (Playwright)
import requests
from playwright.sync_api import sync_playwright
# 1. Ask the app for this profile's debugging endpoint.
started = requests.post(
"http://127.0.0.1:50325/api/v1/browser/start",
params={"profileId": "YOUR_PROFILE_ID"},
headers={"x-api-token": "YOUR_API_TOKEN"},
).json()
# 2. Attach to it like to any other browser.
with sync_playwright() as p:
browser = p.chromium.connect_over_cdp(started["data"]["ws"])
page = browser.contexts[0].pages[0]
page.goto("https://example.com")
สิ่งหนึ่งที่ควรรู้ก่อนเชื่อมต่อ
Puppeteer and Playwright turn on Runtime.enable and Page.enable the moment they attach. Runtime.enable puts observers inside Chromium that page scripts can notice. Our own automation builder never turns it on. It turns on Page.enable only while a flow runs, on the tabs the flow uses, so it can answer a page's alert or confirm; a test page that looks for traces saw nothing from it on either engine. If the site you work with checks for this, build the sequence in the app instead.
หรือทำโดยไม่ต้องเขียนโค้ดเลย
สิบหกชนิดของขั้นตอนในหน้าต่างเดียว เปิด คลิก พิมพ์ รอ อ่าน แยกทาง ไม่มีตัวสังเกตการณ์ที่ตรวจจับได้ และไม่ต้องติดตั้งอะไร
ดูว่าโปรแกรมทำอะไรได้บ้าง