-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[feature] Make api calls allow objects as selectors #1015
Comments
This would be fixed by supporting parametrized page object elements. There is an open PR regarding this: #1001. You could also create a custom command, e.g. "clickXpathElement" that would take care of the css/xpath switch. |
I also ran into this issue (having to switch between this. and this.api.). var myCommand = {
doSomeStuff: function() {
this.api
.waitForElementVisible('.backend ul.list')
.useXpath()
.click("//a[.='Publish']")
.useCss()
.waitForElementVisible(".container")
return this.api;
}
}; |
What I would like this on all commands not just the |
Ah, ok, got it. Thought the point was chaining commands... |
@EloB It sounds like what you're after is already in master via #1156 (a custom @Tex-Hex You need to be careful about returning I remember discussing the possibilities of expanding the page object api to include all commands, but there are some road blocks, notably collisions with |
@senocular Looks promising... I would still want a helper to make it a bit shorter... To avoid lines longer than 120 chars. :) // My example
import { xPath } from 'nightwatch';
this.api.click(xPath(`//*[text()='${customText}']`));
// vs current implementation
this.api.click(({selector:'//*[text()='${customText}']', locateStrategy:'xpath'}); |
I been using nightwatch with page objects and sometimes I need to switch between css selectors and xpath. I want as clean code as possible. Here an example below that explains the feature request.
Current solution
Wanted solution
The text was updated successfully, but these errors were encountered: