laurentj / slimerjs

A scriptable browser like PhantomJS, based on Firefox
http://slimerjs.org
Other
3k stars 259 forks source link

SlimerJS doesnt respond to manual keyboard input #213

Open peterwilli opened 10 years ago

peterwilli commented 10 years ago

Hi,

I'm working on a project that uses slimer to let the user manually login trough the page window and then waits for the user to do so with an interval. Unfortunately, on OS X Mavericks, I cannot type anything in the login screen my script loads.

The code this bug is happening is here: https://github.com/CodeBuffet/Slekkel/blob/29d2163e779dec7717bccad485b9ea088dc11997/Main.coffee

Thanks in advance!

laurentj commented 10 years ago

First SlimerJS is not supposed to be manipulated by a human, only by a script (even if SlimerJS is not headless yet, the user is not supposed to see the window) . Your script should retrieve the login informations from the command line parameter, and set them into the login form and submit the form. So the user has just to call slimerjs and your script with his credentials in parameters.

Second, to test the location, window.location.href should be evaluated via page.evaluate, or you should check page.url.

Third, you should clear the interval before calling onAuth, to avoid multiple call of onAuth (interval of 100ms is very very little for this kind of usage, and the loading of a page like /admin/emoji takes more than 100ms)

Fourth: on linux, I can type something. I don't have OS X Mavericks to test.

Which version of SlimerJS and Gecko you have?

peterwilli commented 10 years ago

Hi @laurentj , thanks for your response, I wasnt aware the window was something that is not supposed to be there (I actually saw it as an advantage over PhantomJS because you can see what's happening + it makes interaction with the scripts really easy, and it would have been a nice touch to enter your details in the actual login screen)

Anyway, I'll go to command parameters then. It will only be the login that requires input. Thanks for pointing out the onAuth stuff, wasnt aware that the window.location setter was synchronous :)

As for the version details, I have Mac OS X 10.9.4 As for slimerjs version, I can't really seem to find a way to get the current version (I did try --version) but my slimerjs version is now captured in the package.json (which is 0.9.1-2, see here: https://github.com/CodeBuffet/Slekkel/blob/master/package.json)

Also I have the standalone version I think (I do have and use firefox as we speak but I dont think it uses the rendering engine from there, it downloads xulrunner when doing npm install)