Add: childSelector

This commit is contained in:
Corentin Barreau 2019-11-03 13:21:23 +01:00
parent a85d95e145
commit e414658056

View File

@ -33,6 +33,7 @@ class UmbraBehavior {
// should match older default and simpleclicks behavior, and more // should match older default and simpleclicks behavior, and more
var k = this.index; var k = this.index;
var selector = this.actions[k].selector; var selector = this.actions[k].selector;
var childSelector = this.actions[k].childSelector;
var repeatSameElement = this.actions[k].repeatSameElement ? this.actions[k].repeatSameElement : false; var repeatSameElement = this.actions[k].repeatSameElement ? this.actions[k].repeatSameElement : false;
var firstMatchOnly = this.actions[k].firstMatchOnly ? this.actions[k].firstMatchOnly : false; var firstMatchOnly = this.actions[k].firstMatchOnly ? this.actions[k].firstMatchOnly : false;
var action = this.actions[k].do ? this.actions[k].do : 'click'; var action = this.actions[k].do ? this.actions[k].do : 'click';
@ -90,6 +91,17 @@ class UmbraBehavior {
var where = this.aboveBelowOrOnScreen(doTargets[i]); var where = this.aboveBelowOrOnScreen(doTargets[i]);
if (where == 0) { if (where == 0) {
this.doTarget(doTargets[i], action); this.doTarget(doTargets[i], action);
if (childSelector) {
var childSelectors = documents[j].querySelectorAll(childSelector);
while (childSelectors.length > 0) {
for (var i = 0; i < childSelectors.length; i++) {
if (this.isVisible(childSelectors[i])) {
childSelectors[i].click();
}
}
childSelectors = documents[j].querySelectorAll(childSelector);
}
}
didSomething = true; didSomething = true;
break; break;
} else if (where > 0) { } else if (where > 0) {