Reputation: 411
I have used following step def for capture error message from given pop up modal
Then warning "Invalid file. File name should be "Users.xml" " should be given to user
In this case I want to include "User.xml" inside the given string
@Then("^warning \"([^\"]*)\" should be given to user
But this will not escaping the ". How do I escape this " character for matching the exact string
Upvotes: 0
Views: 1673
Reputation: 3253
You need to change
@Then("^warning \"([^\"]*)\" should be given to user
to
@Then("^warning \"(.*?)\" should be given to user$"
[^"]*
is matching everything except quotes
.*?
will match everything (including quotes )
For more information See here
You can also use multiline string to do that as explained in above link
Also see this video tutorial for including strings in your arguments
Upvotes: 1