Answered question

How do I find the current URL location at runtime?

I am looking to find the current URL that the user has hit at runtime through Javascript so I can store this variable for use elsewhere. This is a repeated task so I am looking to contain this in a shared container and not have to use variable extractors on each type of page that I hit. Is there an equivalent to window.location available for my Javascript to use?

David N.
David N.

David N.

Level
0
20 / 100
points
Nouredine A.
Nouredine A.

Nouredine A.

Level
4
5000 / 5000
points
Team

No i think that the only way is to use variable extractor. One of the reason is that a NeoLoad javascript is at the same level of a page. So even if you can get the current URL (using Javascript or JAVA code) , it might be the last request played from the NeoLoad page.

If it can help  a variable extractor can be copied/pasted so you don't have to re-create it all the time. Of course only if the way to extract is always the same.

 

 

Did you find this useful ?

No (0)

Yes (0)

0% of users found this answer useful

Other answers

Nouredine A.
Nouredine A.

Nouredine A.

Level
4
5000 / 5000
points
Team

I'm not sure to understand your needs here. There's not really a current URL that can be captured through a NeoLoad javascript. You can use NeoLoad javascript to get the content of some variables used in your script and stored them if needed.

This is "getValue" and "SetValue" described here

Is it what you would like to do?

Please describe a bit if it's not the case.

 

David N.
David N.

David N.

Level
0
20 / 100
points

Hi Nouredine, The website we are building sends a javascript update to our servers from every page and I want to replicate this and take it in to account in our load tests. The update includes the current browser URL so I was wondering if there was a way to extract this without having to set a variable extractor on each page?

David N.
David N.

David N.

Level
0
20 / 100
points

OK, Thanks for your help