Extract hidden value from html response

Hi,

I’m trying to capture hidden fields from html response, for some ids it’s working but not for all.

HTML Response: (Sample)

`

... ... ...
 
 
... ... `

Gatling HTTP Request:

.exec(http("DetailPage") .post("/***/ajax/***") .headers(headers_2) .resources(http("BillDetail") .post(uri1 + "/router/***/simple-read.htm") .headers(headers_0) .formParam("entityId", "BillEntity") .formParam("rowId", "${BillRowId}") ... .formParam("exportConfigurationRowId", "") .check(css("#invoiceHeaderExts.invoiceHeaderExtRowId", "value").saveAs("InvoiceExtRowId")) .check(css("#invoiceStatus", "value").find.saveAs("Old_InvoiceStatus"))) )

Here I’m able to capture “#invoiceStatus” value successfully, but not for “#invoiceHeaderExts.invoiceHeaderExtRowId”.

I tried many combination (mentioned below) but no luck, same time all are working for “#invoiceHeaderRowId” & “#invoiceStatus”.

.check(css("#invoiceHeaderExts.invoiceHeaderExtRowId", “value”).saveAs(“InvoiceExtRowId”))
.check(css(“input[id$=‘invoiceHeaderExtRowId’]”, “value”).saveAs(“InvoiceExtRowId”))
.check(css(“input[id=‘invoiceHeaderExts.invoiceHeaderExtRowId’]”, “value”).find.saveAs(“InvoiceExtRowId”))

Can someone please help me to solve this?

Thanks & Regards,
Aditya Agrawal

.check(css("#invoiceHeaderExts.invoiceHeaderExtRowId", “value”).saveAs(“InvoiceExtRowId”))

dot is a special character, as it’s used for a class selector. You have to escape it with backslash.

.check(css(“input[id=‘invoiceHeaderExts.invoiceHeaderExtRowId’]”, “value”).find.saveAs(“InvoiceExtRowId”))

should work. You probably have a typo somewhere.

Thanks Stéphane for quick response.

I rechecked the typo, i don’t see any issue. I will try with backslash and see if it works.

Anyway, Thanks once again.

-Aditya

.find is missing

.check(css(“input[id=‘invoiceHeaderExts.invoiceHeaderExtRowId’]”, “value”).find.saveAs(“InvoiceExtRowId”))

No it’s not: it’s the default value for this step.