Created
November 23, 2018 06:24
-
-
Save muhammadfaizan/a44e46d05d0301f66a69334c5c21003a to your computer and use it in GitHub Desktop.
Script to expand through table and nested table.
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
function resetSeller(box, oldbox) { | |
var iconClassName = '.expander.class.name'; | |
if (box === null) { | |
box = oldbox.parentElement; | |
console.log(box); | |
} | |
var expander = box.querySelector(iconClassName); | |
if (expander) { | |
expander.click(); | |
setTimeout(() => { | |
function findTableRow(finderNode) { | |
if (finderNode.constructor === HTMLTableRowElement) { | |
return finderNode.nextElementSibling; | |
} | |
return findTableRow(finderNode.parentElement); // find the table row next to expander | |
} | |
var newBox = findTableRow(expander); | |
resetSeller(newBox); | |
}, 3000); // delay for any API call | |
} else { | |
resetSeller(box.nextElementSibling, box); | |
} | |
} | |
resetSeller(document); // start with document itself |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment