Robot Framework: Get a specific part of the url
I’m very new working with Python and Robot Framework, I have the following url:
https://site-of-the-company/r/x/a0l3h000001HlRxAAK/view
I’d like to get the id of the page: a0l3h000001HlRxAAK
Already tried using regex like this:
${url}= Get Location ${id}= Get Regexp Matches ${url} \\d
But got this:
${id} = ['0', '3', '0', '0', '0', '0', '0', '1']
If you are sure the structure of the page will remain the same, you can use urllib.parse.urlparse
to get the path, split the path using str.split
and access the id from the resulting array