how to run XPath in Chrome console All In One
Command Line API
Command Line API 詳情
https://developer.chrome.com/docs/devtools/console/utilities/#xpath-function
Chrome console API
https://developer.chrome.com/docs/devtools/console/api/
Chrome console & Command Line API
$;
ƒ $(selector, [startNode]) { [Command Line API] }
$$;
ƒ $$(selector, [startNode]) { [Command Line API] }
$x;
ƒ $x(path [, startNode]) { [Command Line API] }
update 2022.11.25
$;
ƒ $() { [native code] }
$.toString();
'function $(selector, [startNode]) { [Command Line API] }'
$$;
ƒ $$() { [native code] }
$$.toString();
'function $$(selector, [startNode]) { [Command Line API] }'
$x;
ƒ $x() { [native code] }
$x.toString();
'function $x(xpath, [startNode]) { [Command Line API] }'
XPath 從 1 開始計算
solutions
$x()
function
$x;
// ƒ $x() { [native code] }
$x(`/html/head/meta`);
// (28) [meta, meta, meta, meta, meta, meta, meta, meta, meta, meta, meta, meta, meta, meta, meta, meta, meta, meta, meta, meta, meta, meta, meta, meta, meta, meta, meta, meta]
- 快捷鍵
Command + F
在 Elements Panel 搜索
$$()
function ❌
$$;
// ƒ $$() { [native code] }
$$(`/html/head/meta`);
// Uncaught DOMException: Failed to execute '$$' on 'CommandLineAPI': '/html/head/meta' is not a valid selector.
XPath
W3C Standards
demo
https://cuiqingcai.com/202231.html
refs
https://www.bitdegree.org/learn/chrome-command-line
©xgqfrms 2012-2021
www.cnblogs.com/xgqfrms 發佈文章使用:只允許註冊用戶纔可以訪問!
原創文章,版權所有©️xgqfrms, 禁止轉載 🈲️,侵權必究⚠️!