I want to retrieve the request parameters of the URL using selenum-1 Is there a way? I saw the API list getLocation() method returns the absolute URL.
If the URL is http://webserver/webapps/library/do/javabooks/author?author_id=42&book_id=55
If I am writting selenium.getLocation() it returns me http://webserver/webapps/library/do/javabooks/author. But I am interested in the request parameters. Or if I can get the full URL with request parameters using Selenium API that is also fine.
Is there any way?
Thanks in advance.
I don’t know of any function that does that… it is possible to verify the URL like you said, but for things that are just slightly different I tend to use Javascript:
If you need it often you might consider wrapping it in a library or function, but this seems quite clean to me. You could expand the Javascript a little to get more control over the returned data: splitting on the
?character and take only the second item in the array, for example. From that point on, perhaps split again on&to get the parameters returned as a list of strings?