Last active
July 30, 2018 04:25
-
-
Save adam-acosta/01e5e2c45766f45238bba1ceefa3580a to your computer and use it in GitHub Desktop.
Revisions
-
adam-acosta renamed this gist
Jul 30, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
adam-acosta revised this gist
Jul 30, 2018 . 1 changed file with 7 additions and 17 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ var loadMoreCoachesAttempts = 0; var loadMoreButtonSelector = '#main-app-content-container > div > ui-view > promote-container > div > div > div > div:nth-child(1) > promote-recipient-select > div > div.promote-recipient-select-pager.ng-scope > button'; function waitForElementToDisplay(selector, time) { @@ -9,31 +9,28 @@ function waitForElementToDisplay(selector, time) { setTimeout(function() { waitForElementToDisplay(selector, time); }, 500); } else { if (loadMoreCoachesAttempts === 3) { addCoaches(); return console.log('loaded and selected all coaches or internet issue encountered'); } loadMoreCoachesAttempts++; setTimeout(function() { waitForElementToDisplay(selector, time); }, time); } } function getElementsByText(str, tag = 'a') { return Array.prototype.slice.call(document.getElementsByTagName(tag)).filter(el => el.textContent.trim() === str.trim()); } function addCoaches() { var addButtons = getElementsByText('Add', 'button'); @@ -42,11 +39,4 @@ function addCoaches() { } } waitForElementToDisplay(loadMoreButtonSelector, 1000); -
adam-acosta revised this gist
Jul 30, 2018 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -28,6 +28,7 @@ function waitForElementToDisplay(selector, time) { } function getElementsByText(str, tag = 'a') { return Array.prototype.slice.call(document.getElementsByTagName(tag)).filter(el => el.textContent.trim() === str.trim()); } @@ -47,4 +48,5 @@ function main() { addCoaches(); } main(); -
adam-acosta revised this gist
Jul 30, 2018 . 1 changed file with 47 additions and 18 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,21 +1,50 @@ var loadMoreCoachesAttempts = 0; var loadMorebutton = '#main-app-content-container > div > ui-view > promote-container > div > div > div > div:nth-child(1) > promote-recipient-select > div > div.promote-recipient-select-pager.ng-scope > button'; function waitForElementToDisplay(selector, time) { if (document.querySelector(selector) != null) { document.querySelector(selector).click(); setTimeout(function() { waitForElementToDisplay(selector, time); }, time); } else { if (loadMoreCoachesAttempts === 6) { console.log('loaded all coaches or internet issue encountered'); return; } loadMoreCoachesAttempts++; setTimeout(function() { waitForElementToDisplay(selector, time); }, time); } } function getElementsByText(str, tag = 'a') { return Array.prototype.slice.call(document.getElementsByTagName(tag)).filter(el => el.textContent.trim() === str.trim()); } function addCoaches() { var addButtons = getElementsByText('Add', 'button'); for (var i = 0; i <= addButtons.length - 1; i++) { addButtons[i].click(); } } function main() { waitForElementToDisplay(loadMorebutton, 1000); addCoaches(); } main(); -
adam-acosta revised this gist
Jul 30, 2018 . No changes.There are no files selected for viewing
-
adam-acosta created this gist
Jul 30, 2018 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ var i = 0; function waitForElementToDisplay(selector, time) { if(document.querySelector(selector)!=null) { if (i === 6) { console.log('loaded all coaches or internet issue encountered'); return; } document.querySelector(selector).click(); i++; setTimeout(function() { waitForElementToDisplay(selector, time); }, time); } else { setTimeout(function() { waitForElementToDisplay(selector, time); }, time); } } waitForElementToDisplay('#main-app-content-container > div > ui-view > promote-container > div > div > div > div:nth-child(1) > promote-recipient-select > div > div.promote-recipient-select-pager.ng-scope > button', 1000);