Unable to get #id attribute from Web Element

Hi Team,

I am trying to fetch 6 ID Attribute for multiple elements so that they can be used as feeder in different Scenarios Request I tried with Xpath and css both but still not successful

1. with Xpath I am able to locate the each element but can't fetch out @id attribute from the same

val testID1 = xpath("//locator").saveAs("testID1)

2. With Css Selector(.class method or div locator) I am able to select Multiple elements but again can't fetch out the unique ID from from all the elements which got selected on chrome Console developer mode

val testID1 = css("input[id*='dform']","id").saveAs("testID1")

This css locator expression gives multiple results on Chrome console developer mode
Syntax for console as follows:

To fetch unique ID I tried this
But this is giving invalid syntax in Gatling.

I suspect you’re confusing paths (xpath or css selector) that you can apply with your browser on the actual DOM tree that’s been modified with JavaScript, and what you can do with Gatling.
Gatling, like every proper load test tool, works on network payloads, ie xpath works on XML and css selectors work on HTML pages or fragments generated server side. Gatling doesn’t execute browsers, doesn’t load in memory DOM and doesn’t execute JavaScript.

Hi Stephan,

Thanks for the updates. The ID's which I am trying to get will be used as a feeder to Form Data in Post Request . This Post Request is part of the Gatling Load Testing Scenario.

In absence of these IDs we are bound to hardcode the values of FormData which is not the correct way of preparing scenarios/writing code in any language/Tool.

So Any Help would be great.Thanks.

I’m not telling you don’t have to implement correlations, I’m telling you you can’t implement them based on what you see in your browser like you’re used to with functional testing with tools such as Selenium. You have to check the payloads that go on the wire, eg REST API calls whose content is then injected in the browser DOM.