-
Notifications
You must be signed in to change notification settings - Fork 520
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
Asserting "non empty" #849
Comments
Hi @DannyBen, The We could add the |
The |
Alright, cool - so I take it that opening such "question" issues is acceptable?
Excellent, this would be nice. |
Just a side note, about the behaviour of xpath capture. We're doing the same thing that a browser will do.
The path expression
That's why your capture returns an empty string.
That's said, in this case, your solution might be better (it avoids the repetition of the path expression) |
Thanks for clarifying. Yes I prefer the "semantic" and DRY approach. Once the |
First, may I suggest opening the "Discussions" tab so people have a place to ask the community questions without polluting the issues?
I am trying to figure out the simplest way to assert non empty captures. Could not find anything in the docs.
First, I expected this to already fail if it is empty:
[Captures] auth_token: xpath "string(//input[@name='no-such-input']/@value)"
but I understand if the design intention was to allow capturing empty things. So then, I was happy to find the
exist
matcher:now I am confused - what is the purpose of
exists
then? Does it just test that I used it as a variable name in the captures section above?So the only way to test that the captured variable is non empty I found was using some regex:
[Asserts] variable "auth_token" matches /^.{60,100}$/
If this is the only way, I would like to suggest a matcher
nonempty
or to change theexists
behavior (although I am sure it has its own purpose).The text was updated successfully, but these errors were encountered: