Trouble with selectors, when trying to select children of specific elements...

Using Gatling 2.2.2

I need to select using some complicated selectors to extract items from a page.

These selectors all work fine when using Chrome’s developer mode search functionality, so they seem to be formatted appropriately.

I’ve tried using both CSS and XPath selectors.

css(“div[id=vertical-slider-pager] > a”, “href”).findAll.optional.saveAs(“categories”)

css(“div[class=sub-nav-column] > ul > li > a”, “href”).findAll.optional.saveAs(“categories”)

xpath("//div[@id=‘vertical-slider-pager’]/a/@href").findAll.optional.saveAs(“categories”)

xpath("//div[@class=‘sub-nav-column’]/ul/li/a/@href").findAll.optional.saveAs(“categories”)

However, I keep failing to get anything stored to “categories”, so it seems the selectors aren’t matching anything. Are such selectors simply not supported by CSSelly, or am I doing something wrong? I’ve used both types of selectors before but I don’t think I’ve tried to select children of elements before…

XPath only works with XML, so it would work if your payload was XHTML, but not play HTML.

Then, Gatling checks work on the HTTP payloads. Beware that with Chrome, you have a DOM tree that might have been edited by some Javascript. Check the actual payload from the network panel and use an online evaluator to check that your selectors actually match something in there.

Ah, yes, my problem was that JS was transforming the DOM. D’oh.