2

I need help figuring out this XPATH substring function, which I cannot get to work. I have tried all kinds of variations of this:

.//a[contains(text(),'Home')]/@href[substring('jsessionid',12)]

Trying to get the jsessionid value from this tag:

<a href="/myapp/home;jsessionid=521EFCEE442922CF84C0FCC2809EC143">Home</a>

Nothing I try works. Any thoughts?

djangofan
  • 28,471
  • 61
  • 196
  • 289

2 Answers2

1

Using this method, you can get the jsessionid from the 24th index of the @href attribute like this:

substring(//a[contains(text(),'Home')]/@href, 24)

Example

Community
  • 1
  • 1
scrowler
  • 24,273
  • 9
  • 60
  • 92
0

XPAth Extractor has known constraing of a lot of memory consumption due to building DOM tree in memory.

I believe that it can be handled much easier using HTTP Cookie Manager.

  1. Add CookieManager.save.cookies=true property to user.properties file which lives under /bin folder of your JMeter installation
  2. Add HTTP Cookie Manager to your Test Plan.
  3. Wherever you require appending JSESSIONID cookie value to url use the following construction:

    /myapp/home;jsessionid=${COOKIE_JSESSIONID}
    
Dmitri T
  • 159,985
  • 5
  • 83
  • 133