detro/ghostdriver — pull request #36 by alxndrsn (2012-06-24 14:40:24+00:00)
Title: Alxndrsn dev

Hi Ivan,

As I said previously, I'm on holiday now for 3 weeks. I read your blog post about rebasing and obviously I haven't done that here but:
* still waiting for the previous, neater pull request to be merged;
* I don't have time to do much more on this before I go away; and
* if you don't have time to merge while I'm away, at least you can easily see what I've done so we avoid duplicating effort

In your blogpost about rebasing you said "people can grasp your code better, if they can understand how the heck did you came up with it". I've not done non-front-end Javascript before and so there is a lot of console.log where I am working out what's going on. Could remove all of that, but "it tells people (or at least me) what is your line of thought. How do you work, what are your logical steps". So these commits give a pretty honest account of my dev process. Not being a plastic surgeon - mother to a slightly unruly child.

Here's a quick run-down of the changes:

# request_handler
* fixed bug in `_respondBasedOnResultDecorator` - was previously killing phantomjs if result was not a success

# router_request_handler
* safer command matching
* added check that response QObject has not been "deleted" before sending 404 error (demonstrated when `request_handler._respondBasedOnResultDecorator` was not fixed)

# session_request_handler
* attempted to handle javascript alerts. should probably throw this away as it doesn't work and apparently my approach of blocking in onAlert handler is doomed to failure (see Ariya's response to my Q on mailing list). have failing tests for these; currently set to `@Ignore`
* implemented `window/size` POST and GET commands. they work pretty nice, but it seems there's a minimum window size for PhantomJS so if you set it too small, window will be a bit bigger than you might expect

# webelement_request_handler
* implement sub-element searches
* implemented `/text`, `/equals`, `/clear`, `/css/`, `/click`, `/selected` commands

# session
* some mess related to JS `alert()`, `confirm()`, `prompt()` handling. see `session_request_handler`

# webelementlocator
* added sub-element searching
* removed cacheing of webelement in single element search. you had a TODO saying it could go, and it didn't seem to do anything...

# build.gradle
* added support for Geb tests
* added support for starting Ghostdriver as part of the test startup. Currently this always seems to happen, which I'm a bit confused by but very new to Gradle so it's probably obvious why
* added local webserver to serve test HTML. this also starts whether you tell it to or not
* upgraded to gradle 1.0 final release (seemed a reasonable thing to do)
* changed selenium to be only available in tests. more correct, but clearly doesn't matter as we're not building ghostdriver with gradle
* TODO would be cool if we could specify server port in e.g. gradle.settings - it's a bit annoying having everything use 8080 as that's what my day job uses as well by default

-----

Hope you can put some of this to good use, and if you don't get a chance to merge then let's catch up when I get back and discuss the best way to get this stuff into ghostdriver core, or why it shouldn't be there.

Cheers,

Alex

P.S. I'll get better at rebasing, I promise