Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Cookie Before Load? #7

Closed
lxcodes opened this issue Oct 3, 2014 · 2 comments
Closed

Adding Cookie Before Load? #7

lxcodes opened this issue Oct 3, 2014 · 2 comments

Comments

@lxcodes
Copy link

lxcodes commented Oct 3, 2014

Currently attempting to load a cookie before the loading of the page / browser but having issues. Is this possible or am I doing this wrong? Rather new to golang.

cookie := selenium.Cookie{"domain_splash", "1", "/", ".domain.com", false, 0}
webDriver.AddCookie(&cookie)
@sqs
Copy link
Member

sqs commented Oct 4, 2014

I am on vacation and not at my computer for another week but that seems right to me. I can pull up the snippet we use in our private code base if you still haven't gotten it to work by next Wed (please remind me by posting again then).

One thing I ran into with setting cookies (which is what you are probably encountering too) is that you do need to be on the same domain in the browser already. So we made our app return a quickly loading blank page at /cookietest and navigated to that in Selenium before setting cookies. This is a browser restriction not a Selenium or go-selenium restriction. (Otherwise how would know which domain the cookie was for?)

@lxcodes
Copy link
Author

lxcodes commented Oct 6, 2014

Makes sense on the second part there. I'll try to investigate and report back. Will need to ask the devs to add something in.

We are currently avoiding our splash screen using a javascript snippet for window.goBack() for now which seems to be working rather reliably -- Just extra load time is all. =]

Closing for now with the work around for me and I believe that the second paragraph from @sqs holds the key to the issue. Thanks for the reply @sqs!

@lxcodes lxcodes closed this as completed Oct 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants