Capture the URL in the javascript initiated HTTP GET/POST requests using selenium

36 views
Skip to first unread message

yoni

unread,
May 18, 2015, 5:47:04 AM5/18/15
to seleniu...@googlegroups.com

I'm using selenium for automating a procedure I frequently use on a site.

When I press on specific element on the site it runs some complex javascript code that eventually downloads a csv file using HTTP GET request. I can see that the URL of this request looks like: www.somesite.com/somepage.php?token=RAPO09834HROLQ340HGIE309W&....

My question is: how can I get the token in this URL with selenium? (I need it for executing other HTTP GET requests for extracting more data from the site)

I am using Firefox driver on windows.

I tried to search all the html, js, cookies I get from this site, the token is not there. (its probably generated by the javascript code before it does the HTTP request)

I understand this is some kind of session id token as all the javascript generated HTTP requests are using the same token during my session.


Villju Joseph

unread,
May 22, 2015, 8:51:17 AM5/22/15
to seleniu...@googlegroups.com

Capture the current url and assign to a variable.Extract the token from that string

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/d372dfa0-6a2c-4150-9de2-10982e46a510%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Villju Joseph

unread,
May 22, 2015, 8:54:19 AM5/22/15
to seleniu...@googlegroups.com

Use getCurrentUrl to capture current url(java)

On 18-May-2015 3:16 pm, "yoni" <yon...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages