MachinePublishers / jBrowserDriver

A programmable, embeddable web browser driver compatible with the Selenium WebDriver spec -- headless, WebKit-based, pure Java
Other
809 stars 143 forks source link

Try to login to facebook but no cookies activated #278

Closed dlaske closed 6 years ago

dlaske commented 7 years ago

Hello, i try to login to facebook with the jbrowser but i got an issue that no cookies activated. WIth phantomjs i could successfully logged in. This is my source to initialize the jbrowser: private static JBrowserDriver getJBrowserDriver() { Builder builder = Settings.builder() .requestHeaders(RequestHeaders.CHROME) .userAgent(UserAgent.CHROME).cache(true) .cacheDir(new File("/tmp")); JBrowserDriver driver = new JBrowserDriver(builder.timezone( Timezone.EUROPE_BERLIN).build());

return driver; }

I hope you could give me a hint to fix it.

Thanks in advance

dlaske commented 7 years ago

Do you want an example? @hollingsworthd

hollingsworthd commented 7 years ago

I think this is enough to go on. Thank you for submitting this issue!

dlaske commented 7 years ago

Thank you that you help me to use this library. ;-) @hollingsworthd

dlaske commented 7 years ago

@hollingsworthd i really need this fix. Could you give me a hint to fix it ?

hollingsworthd commented 7 years ago

Try settings both of these to true:

http://machinepublishers.github.io/jBrowserDriver/com/machinepublishers/jbrowserdriver/Settings.Builder.html#logTrace-boolean- http://machinepublishers.github.io/jBrowserDriver/com/machinepublishers/jbrowserdriver/Settings.Builder.html#logWire-boolean-

That will show all the http request info including Set-Cookie headers etc.

hollingsworthd commented 7 years ago

I tried this and it's working here, so the logs may offer some insight.

hollingsworthd commented 7 years ago

Also try setting Settings.builder().headless(false) and log in manually to rule out that there's some problem in the custom automation instead of the cookie handling.

dlaske commented 7 years ago

@hollingsworthd Now i tried headless = false and it works. But i want it headless. Do you need the log file ?

hollingsworthd commented 7 years ago

There are some differences in headed vs headless but not that many. In headless mode with your automation, it may be worth using the screenshot API to take screenshots after every browser action (button clicks etc). http://machinepublishers.github.io/jBrowserDriver/com/machinepublishers/jbrowserdriver/JBrowserDriver.html#getScreenshotAs-org.openqa.selenium.OutputType-

There could certainly be a bug in the project. It may be even a likelihood. But I don't use facebook and the volunteer I found to log in was unwilling to divulge their password.

Logs are always nice. You can email them (see my github profile), they may contain sensitive info.

hollingsworthd commented 7 years ago

I extended my previous comment significantly. If reading via email notification please see thread at website for edits.

dlaske commented 7 years ago

@hollingsworthd I send you an email with the log and a screenshot...