HELENDOUDOU
HELENDOUDOU

Reputation: 53

How to get value from html response in Gatling

I am trying to get a value from HTML response using Gatling. Something like

<span>
    <input type="hidden" id="Id" name="userId" value="some value"/>

I want to ge the "value" with

.check(xpath("xpath from browser").find.is("value").saveAs("userId"))

But this does not work. How can I get that?

Upvotes: 0

Views: 2202

Answers (2)

antonkronaj
antonkronaj

Reputation: 1367

According to gatling documentation

XPath only works on well-formed XML documents, which HTML is not.

If you’re looking for path based engine for parsing HTML documents, please have a look at our CSS selectors support.

Another option may be regex.

Upvotes: 0

James Warr
James Warr

Reputation: 2604

I haven't used xpath checks much, but you can probably achieve the desired result with the css check

.check(css("#Id","value").saveAs("userId"))

Upvotes: 2

Related Questions