ស្វ័យប្រវត្តិកម្មកម្មវិធីរុករក
ក្រុមពាក្យបញ្ជាកម្មវិធីរុករក icc ផ្ដល់ស្វ័យប្រវត្តិកម្មកម្មវិធីរុករកលើ surface កម្មវិធីរុករក icc។ ប្រើវាដើម្បីរុករក, ធ្វើអន្តរកម្មជាមួយធាតុ DOM, ពិនិត្យស្ថានភាពទំព័រ, វាយតម្លៃ JavaScript, និងគ្រប់គ្រងទិន្នន័យវគ្គកម្មវិធីរុករក។
សន្ទស្សន៍ពាក្យបញ្ជា
| ប្រភេទ | ពាក្យបញ្ជារង |
|---|---|
| ការរុករកនិងការកំណត់គោលដៅ | identify, open, open-split, navigate, back, forward, reload, url, focus-webview, is-webview-focused |
| ការរង់ចាំ | wait |
| អន្តរកម្ម DOM | click, dblclick, hover, focus, check, uncheck, scroll-into-view, type, fill, press, keydown, keyup, select, scroll |
| ការពិនិត្យ | snapshot, screenshot, get, is, find, highlight |
| JavaScript និងការចាក់បញ្ចូល | eval, addinitscript, addscript, addstyle |
| ស៊ុម, ប្រអប់សន្ទនា, ការទាញយក | frame, dialog, download |
| ស្ថានភាពនិងទិន្នន័យវគ្គ | cookies, storage, state |
| ផ្ទាំងនិងកំណត់ត្រា | tab, console, errors |
ការកំណត់គោលដៅ surface កម្មវិធីរុករក
ពាក្យបញ្ជារងភាគច្រើនត្រូវការ surface គោលដៅ។ អ្នកអាចបញ្ជូនវាតាមទីតាំង ឬជាមួយ --surface។
# Open a new browser split
icc browser open https://example.com
# Discover focused IDs and browser metadata
icc browser identify
icc browser identify --surface surface:2
# Positional vs flag targeting are equivalent
icc browser surface:2 url
icc browser --surface surface:2 urlការរុករក
icc browser open https://example.com
icc browser open-split https://news.ycombinator.com
icc browser surface:2 navigate https://example.org/docs --snapshot-after
icc browser surface:2 back
icc browser surface:2 forward
icc browser surface:2 reload --snapshot-after
icc browser surface:2 url
icc browser surface:2 focus-webview
icc browser surface:2 is-webview-focusedការរង់ចាំ
ប្រើ wait ដើម្បីរង់ចាំរហូតដល់ selectors, អត្ថបទ, ផ្នែក URL, ស្ថានភាពផ្ទុក, ឬលក្ខខណ្ឌ JavaScript ត្រូវបានបំពេញ។
icc browser surface:2 wait --load-state complete --timeout-ms 15000
icc browser surface:2 wait --selector "#checkout" --timeout-ms 10000
icc browser surface:2 wait --text "Order confirmed"
icc browser surface:2 wait --url-contains "/dashboard"
icc browser surface:2 wait --function "window.__appReady === true"អន្តរកម្ម DOM
សកម្មភាពផ្លាស់ប្ដូរគាំទ្រ --snapshot-after សម្រាប់ការផ្ទៀងផ្ទាត់រហ័សក្នុងស្គ្រីប។
icc browser surface:2 click "button[type='submit']" --snapshot-after
icc browser surface:2 dblclick ".item-row"
icc browser surface:2 hover "#menu"
icc browser surface:2 focus "#email"
icc browser surface:2 check "#terms"
icc browser surface:2 uncheck "#newsletter"
icc browser surface:2 scroll-into-view "#pricing"
icc browser surface:2 type "#search" "icc"
icc browser surface:2 fill "#email" --text "[email protected]"
icc browser surface:2 fill "#email" --text ""
icc browser surface:2 press Enter
icc browser surface:2 keydown Shift
icc browser surface:2 keyup Shift
icc browser surface:2 select "#region" "us-east"
icc browser surface:2 scroll --dy 800 --snapshot-after
icc browser surface:2 scroll --selector "#log-view" --dx 0 --dy 400ការពិនិត្យ
ប្រើ getters ដែលមានរចនាសម្ព័ន្ធសម្រាប់ស្គ្រីប និង snapshots/screenshots សម្រាប់ការត្រួតពិនិត្យដោយមនុស្ស។
icc browser surface:2 snapshot --interactive --compact
icc browser surface:2 snapshot --selector "main" --max-depth 5
icc browser surface:2 screenshot --out /tmp/icc-page.png
icc browser surface:2 get title
icc browser surface:2 get url
icc browser surface:2 get text "h1"
icc browser surface:2 get html "main"
icc browser surface:2 get value "#email"
icc browser surface:2 get attr "a.primary" --attr href
icc browser surface:2 get count ".row"
icc browser surface:2 get box "#checkout"
icc browser surface:2 get styles "#total" --property color
icc browser surface:2 is visible "#checkout"
icc browser surface:2 is enabled "button[type='submit']"
icc browser surface:2 is checked "#terms"
icc browser surface:2 find role button --name "Continue"
icc browser surface:2 find text "Order confirmed"
icc browser surface:2 find label "Email"
icc browser surface:2 find placeholder "Search"
icc browser surface:2 find alt "Product image"
icc browser surface:2 find title "Open settings"
icc browser surface:2 find testid "save-btn"
icc browser surface:2 find first ".row"
icc browser surface:2 find last ".row"
icc browser surface:2 find nth 2 ".row"
icc browser surface:2 highlight "#checkout"ការវាយតម្លៃនិងចាក់បញ្ចូល JavaScript
icc browser surface:2 eval "document.title"
icc browser surface:2 eval --script "window.location.href"
icc browser surface:2 addinitscript "window.__iccReady = true;"
icc browser surface:2 addscript "document.querySelector('#name')?.focus()"
icc browser surface:2 addstyle "#debug-banner { display: none !important; }"ស្ថានភាព
ពាក្យបញ្ជាទិន្នន័យវគ្គគ្រប cookies, local/session storage, និង snapshots ស្ថានភាពកម្មវិធីរុករកពេញលេញ។
icc browser surface:2 cookies get
icc browser surface:2 cookies get --name session_id
icc browser surface:2 cookies set session_id abc123 --domain example.com --path /
icc browser surface:2 cookies clear --name session_id
icc browser surface:2 cookies clear --all
icc browser surface:2 storage local set theme dark
icc browser surface:2 storage local get theme
icc browser surface:2 storage local clear
icc browser surface:2 storage session set flow onboarding
icc browser surface:2 storage session get flow
icc browser surface:2 state save /tmp/icc-browser-state.json
icc browser surface:2 state load /tmp/icc-browser-state.jsonផ្ទាំង
ប្រតិបត្តិការផ្ទាំងកម្មវិធីរុករកផ្គូផ្គងទៅ surface កម្មវិធីរុករកក្នុងក្រុមផ្ទាំងកម្មវិធីរុករកដែលកំពុងដំណើរការ។
icc browser surface:2 tab list
icc browser surface:2 tab new https://example.com/pricing
# Switch by index or by target surface
icc browser surface:2 tab switch 1
icc browser surface:2 tab switch surface:7
# Close current tab or a specific target
icc browser surface:2 tab close
icc browser surface:2 tab close surface:7Console និងកំហុស
icc browser surface:2 console list
icc browser surface:2 console clear
icc browser surface:2 errors list
icc browser surface:2 errors clearប្រអប់សន្ទនា
icc browser surface:2 dialog accept
icc browser surface:2 dialog accept "Confirmed by automation"
icc browser surface:2 dialog dismissស៊ុម
# Enter an iframe context
icc browser surface:2 frame "iframe[name='checkout']"
icc browser surface:2 click "#pay-now"
# Return to the top-level document
icc browser surface:2 frame mainការទាញយក
icc browser surface:2 click "a#download-report"
icc browser surface:2 download --path /tmp/report.csv --timeout-ms 30000គំរូទូទៅ
រុករក, រង់ចាំ, ពិនិត្យ
icc browser open https://example.com/login
icc browser surface:2 wait --load-state complete --timeout-ms 15000
icc browser surface:2 snapshot --interactive --compact
icc browser surface:2 get titleបំពេញទម្រង់និងផ្ទៀងផ្ទាត់អត្ថបទជោគជ័យ
icc browser surface:2 fill "#email" --text "[email protected]"
icc browser surface:2 fill "#password" --text "$PASSWORD"
icc browser surface:2 click "button[type='submit']" --snapshot-after
icc browser surface:2 wait --text "Welcome"
icc browser surface:2 is visible "#dashboard"ចាប់យកវត្ថុ debug នៅពេលបរាជ័យ
icc browser surface:2 console list
icc browser surface:2 errors list
icc browser surface:2 screenshot --out /tmp/icc-failure.png
icc browser surface:2 snapshot --interactive --compactរក្សាទុកនិងស្ដារវគ្គកម្មវិធីរុករក
icc browser surface:2 state save /tmp/session.json
# ...later...
icc browser surface:2 state load /tmp/session.json
icc browser surface:2 reload