Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(clientSideScripts): Add by.buttonText, by.partialButtonText #455

Closed
wants to merge 1 commit into from

Conversation

Damiya
Copy link
Contributor

@Damiya Damiya commented Jan 25, 2014

Adds client side JS implementations of by.buttonText and
by.partialButtonText, enabling element lookup based on innerText.

Closes #452

@juliemr
Copy link
Member

juliemr commented Jan 25, 2014

Automated CLA checker says: please sign CLA at http://code.google.com/legal/individual-cla-v1.0.html Please make sure that the email associated with your PR is the same as the email you use to sign.

@Damiya
Copy link
Contributor Author

Damiya commented Jan 25, 2014

Done!

@juliemr
Copy link
Member

juliemr commented Jan 25, 2014

CLA signature found, thank you!

@wlingke
Copy link
Contributor

wlingke commented Jan 25, 2014

Big fan of this locator strategy @Damiya Thanks!

@elgalu
Copy link
Contributor

elgalu commented Jan 26, 2014

I pulled this. Worked well on Chrome but failed on Firefox 26 (latest)

Error: No element found using locator: by.buttonText("Sign In")

Are protractor specs being tested against Firefox in Sauce Labs-TravisCI?

@Damiya
Copy link
Contributor Author

Damiya commented Jan 27, 2014

Hey Leo,
Thanks for the report. I'll get my driver set up to include Firefox and
dig into it when I get a chance.

On 1/26/2014 10:44 AM, Leo Gallucci wrote:

I pulled this. Worked well on Chrome but failed on Firefox 26 (latest)

|Error: No element found using locator: by.buttonText("Sign In")
|

Are protractor specs being tested against Firefox in Sauce Labs-TravisCI?


Reply to this email directly or view it on GitHub
#455 (comment).

@cesarandreu
Copy link
Contributor

This is awesome! Thanks @Damiya

@andresdominguez
Copy link
Contributor

Can you add support for input type="button" and input type="submit"?

    by.addLocator('buttonText', function(parentElement, buttonText) {
      var using = parentElement || document,
          buttons = using.querySelectorAll(
              'button, input[type="button"], input[type="submit"]');

      return Array.prototype.filter.call(buttons, function(button) {
        var textContent = button.textContent;
        return textContent && textContent.trim() === buttonText;
      });
    });

@juliemr
Copy link
Member

juliemr commented Jan 31, 2014

Thanks for your work on this - I'll accept if the cross-browser issues are fixed and the support that andres mentioned.

Adds client side JS implementations of by.buttonText and
by.partialButtonText, enabling element lookup based on innerText.

Closes angular#452
@Damiya
Copy link
Contributor Author

Damiya commented Feb 1, 2014

PR updated, tested against IE11, Firefox 26, Chrome 33 locally.

Added the input searchers as well.

@elgalu
Copy link
Contributor

elgalu commented Feb 1, 2014

This is great @Damiya ! Just pulled & tested by.buttonText('Sign In') and by.partialButtonText('Sign In') on a submit input in WIN8: IE9, IE10, FF26, CH32 and SauceLabs: IE9, FF26, CH31 on a heavy angular app :)

@Damiya
Copy link
Contributor Author

Damiya commented Feb 1, 2014

Glad to hear it
On 1/31/2014 5:29 PM, Leo Gallucci wrote:

This is great @Damiya https://github.com/Damiya ! Just pulled &
tested |by.buttonText('Sign In')| and |by.partialButtonText('Sign
In')| on a submit input in WIN8: IE9, IE10, FF26, CH32 and SauceLabs:
IE9, FF26, CH31 on a heavy angular app :)


Reply to this email directly or view it on GitHub
#455 (comment).

@juliemr
Copy link
Member

juliemr commented Feb 1, 2014

Thanks! Added a couple semicolons and merged as 88a1e58

@juliemr juliemr closed this Feb 1, 2014
@Damiya Damiya deleted the feature/byButtonText branch February 1, 2014 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feature request: Add by.buttonText() locator
6 participants