Created
February 28, 2020 15:09
-
-
Save h26k2/612252bd9d21ea62c81df16aa738be2c to your computer and use it in GitHub Desktop.
A short gist for analyzing my xpath
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let str = `BODY[5]/DIV[2]/DIV[0]/DIV[0]/DIV[0]`; | |
let indexes = []; | |
let elems = str.split("/"); | |
let temp_index = []; | |
Array.from(elems).forEach((elem)=>{ | |
let s = elem.indexOf(`[`) + 1; | |
let e = elem.length - 1; | |
temp_index.push(parseInt(elem.substr(s,e))); | |
}); | |
indexes.push([...temp_index]); | |
console.log(indexes); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment