contact  |  about  |  sitemap

Extracting a cookie as a variable?
Last Post 28 May 2009 11:41 PM by Alfgar. 6 Replies.
Sort:
PrevPrev NextNext
Author Messages
Alfgar

--
21 May 2009 09:11 AM
I used the Execute Javascript function to extract a cookie, but, how can I assign the value of that cookie to a variable for export?

Is that possible?


Tijn

--
21 May 2009 11:50 AM
That is tricky. Normally JavaScript is used within the page only.
However I can imagine situation you want to pass a Javascript variable to Djuggler.

This how I would do it.

Execute the JavaScript and use a the title of document to store the output, like document.title = 'my output';

Do a refresh browser source.

Next use a copy text between action to get the Title in a Djuggler variable.

See the attached example.
Tijn

passingjavascriptvariable.djs

Alfgar

--
25 May 2009 12:15 AM
Tijn, great trick - I'd tried somethign like this but was missing the Refresh Borwser Source function.

Ok... another question for you... It seems someone that I can only get the persistent cookies, but not the session-based cookies. Any reason for this?

Specifically, the site sets up a bunch of cookies, but the one I want is the classic ASP.NET SessionId cookie: once I've logged in, I can use it as a "token" that allows me to bypass the login process for future stesp where I "scrape" the site. But, when I read document.cookie, I get all those cookies EXCEPT the ASP.NET SessionId

Any idea?


Tijn

--
25 May 2009 09:13 AM
Hi, I'm not an ASP session expert.
The session ID will be different for each page, created by the server.
I think you don't have to manage the cookies, Djuggler Open Web Page action will do that for you.

This is what I found at Microsoft about session cookies:
http://msdn.microsoft.com/en-us/lib...72338.aspx

Tijn


Alfgar

--
25 May 2009 06:01 PM
Session cookies aren't stored on the file system but within the browser memory space. Forgetting the specifics of the session management on the server side, the reason I'm trying to get this cookie is because the site has a CAPTCHA at login time. With that specific cookie, I can bypass the login process entirely and find myself in a logged-in session to go straight to scrapping. But in this specific case, while I am able to see and retrieve the cookie in FireFox, it doesn't seem to be available in the Djuggler Web Viewer when I pull document.cookie with Javascript. Is it a custom web-browser implementation or the system's web-browser control?


Support Team

--
28 May 2009 08:27 PM
Djuggler uses the webbrowser object from Internet Explorer.
So basically it's the system web-browser control: Twebbrowser.
There are custom modifications for speed and control on the object, but non should interfere with the document object.

So the question is, does IE show the document.cookie?

DS


Alfgar

--
28 May 2009 11:41 PM
Interesting... apparently the website behaves differently between Firefox and IE: IE is missing that cookie I was referring to!

Guess there's nothing that can be done about it.

Thanks for the feedback.




Quick Reply
toggle
  Username:
Subject:
Body:
Security Code:
Enter the code shown above:

Submit

Powered by Active Forums

Forum participation and optional registration

You don't need to be registered to partcipate in the Djuggler forums, however if you want to subscribe to email notifications you need to register. You can also subscribe to the forum RSS feed.