BreadCrumbs: JavaScript
JavaScript
From Luke Jackson
(Difference between revisions)
Revision as of 04:22, 27 October 2016 (edit) Ljackson (Talk | contribs) ← Previous diff |
Revision as of 13:34, 19 June 2018 (edit) Ljackson (Talk | contribs) (→Chrome Xpath) Next diff → |
||
Line 3: | Line 3: | ||
count(//td[text() ="Men's XL"]) | count(//td[text() ="Men's XL"]) | ||
//td[text() ="Men's XL"] | //td[text() ="Men's XL"] | ||
+ | //td[8] | ||
+ | //option/@value | //select/@id | //input/@id | //select/optgroup/@label | //option/text() | ||
+ | |||
+ | === Chrome, Firefox Xpath === | ||
+ | |||
+ | Open developer tools to access the console and use the xpath function call to iterate the array of option items for the select object. Log them to the console using a for each function loop. | ||
+ | |||
+ | $x('//*[@id="miles"]/option/text()').forEach(function(el){console.log(el)}); | ||
+ | |||
+ | Export p element text | ||
+ | |||
+ | $x('//p/text()').forEach(function(el){console.log(el)}); | ||
+ | |||
+ | '''Sources:''' | ||
+ | |||
+ | * https://developers.google.com/web/tools/chrome-devtools/console/command-line-reference#xpath |
Revision as of 13:34, 19 June 2018
XPath
count(//td[text() ="Men's XL"]) //td[text() ="Men's XL"] //td[8] //option/@value | //select/@id | //input/@id | //select/optgroup/@label | //option/text()
Chrome, Firefox Xpath
Open developer tools to access the console and use the xpath function call to iterate the array of option items for the select object. Log them to the console using a for each function loop.
$x('//*[@id="miles"]/option/text()').forEach(function(el){console.log(el)});
Export p element text
$x('//p/text()').forEach(function(el){console.log(el)});
Sources: