Retrieve and store a specific parameter from the URL


I’d like to ask for your help regarding KR. While recording, I want to extract a parameter from the URL and store it in a variable that I will use later in the process.


Browser URL:

1_ I want to extract the product ID —> 35487747862f901
2_ I want to store it in a variable
3_ Use this variable to target an attribute later in the process

I’ve looked at a few questions on the forum regarding achieving this via scripting, but I’m not sure how exactly can I put this all together.



How about using the split command on the URL and use the slash ( / ) as the separator? You now have to count how many slashes are used (starting at 0).

(I want to extract sentences after"~" - #6 by akiganai)

So, maybe like:

storeEval | ${urlLine}.split("/")[4] | productCode

Note: The “split” command takes a RegEx as its parameter, so if the character you want to separate on is a RegEx character, then you need to add two \\ in front of your separator.

1 Like


Thank you @grylion54 & @kazurayam