Skip to content

Commit

Permalink
add new selector: activeSelector for chromy
Browse files Browse the repository at this point in the history
  • Loading branch information
silentHoo committed Apr 11, 2018
1 parent 29f48bb commit 5795338
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions capture/engine_scripts/chromy/clickAndHoverHelper.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = function (chromy, scenario) {
var hoverSelector = scenario.hoverSelector;
var clickSelector = scenario.clickSelector;
var activeSelector = scenario.activeSelector;
var postInteractionWait = scenario.postInteractionWait; // selector [str] | ms [int]

if (hoverSelector) {
Expand All @@ -18,6 +19,15 @@ module.exports = function (chromy, scenario) {
.click(clickSelector);
}

if (activeSelector) {
chromy
.wait(activeSelector)
.rect(activeSelector)
.result(function (rect) {
chromy.mousePressed(rect.left + rect.width/2, rect.top + rect.height/2);
});
}

if (postInteractionWait) {
chromy.wait(postInteractionWait);
}
Expand Down

3 comments on commit 5795338

@garris
Copy link
Owner

@garris garris commented on 5795338 Apr 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. Thank you.

@garris
Copy link
Owner

@garris garris commented on 5795338 Apr 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you please add this to the readme?

@silentHoo
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah of course 👍

Please sign in to comment.