devtools commandline api: $x

Chrome devtool have lots of useful commandline api. Here I introduce the $x(path)

$x(path)

Returns an array of DOM elements that match the given XPath expression.

Demo

all the p elements that contain a elements:

$x("//p[a]")

img

select node with special attribute

// get all node with `data-uix` attribute
$x('//*[@data-uix]')

img

all a with parent li

$x('//li/a')

img

refer

comments powered by Disqus