Skip to content

Instantly share code, notes, and snippets.

@adam-acosta
Last active July 29, 2018 20:16
Show Gist options
  • Select an option

  • Save adam-acosta/d07ef2bc844a49ce8acc6d5966c57f29 to your computer and use it in GitHub Desktop.

Select an option

Save adam-acosta/d07ef2bc844a49ce8acc6d5966c57f29 to your computer and use it in GitHub Desktop.

Revisions

  1. adam-acosta revised this gist Jul 29, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion click buttons with text value.js
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,6 @@ function getElementsByText(str, tag = 'a') {

    var addButtons = getElementsByText('Add', 'button');

    for(var i = 0; i <= addButtons.length; i++) {
    for(var i = 0; i <= addButtons.length-1; i++) {
    addButtons[i].click();
    }
  2. adam-acosta revised this gist Jul 29, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion click buttons with text value.js
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@ function getElementsByText(str, tag = 'a') {
    return Array.prototype.slice.call(document.getElementsByTagName(tag)).filter(el => el.textContent.trim() === str.trim());
    }

    var addButtons = getElementsByText('Promote again', 'button');
    var addButtons = getElementsByText('Add', 'button');

    for(var i = 0; i <= addButtons.length; i++) {
    addButtons[i].click();
  3. adam-acosta created this gist Jul 29, 2018.
    10 changes: 10 additions & 0 deletions click buttons with text value.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    // https://stackoverflow.com/a/45089849
    function getElementsByText(str, tag = 'a') {
    return Array.prototype.slice.call(document.getElementsByTagName(tag)).filter(el => el.textContent.trim() === str.trim());
    }

    var addButtons = getElementsByText('Promote again', 'button');

    for(var i = 0; i <= addButtons.length; i++) {
    addButtons[i].click();
    }