semperos/clj-webdriver — pull request #78 by smidas (2012-09-28 00:55:06+00:00)
Title: IWindow protocol

Adds functionality to programmatically manage the size and relative position of the browser window. The protocol is declared and implemented in the `clj-webdriver.window` namespace, in which contains the following functions:

```clj
(position [driver] "Returns map of X Y coordinates ex. {:x 1 :y 3} relative to the upper left corner of screen.")
(reposition! [driver point-map] "Excepts map of X Y coordinates ex. {:x 1 :y 3} repositioning current window relative to screen.")
(size [driver] "Get size of current window; returns a map of width and height ex. {:width 480 :height 800}")
(resize! [driver dim-map] "Resize the driver window with a map of width and height ex. {:width 480 :height 800}.")
(maximize! [driver] "Maximizes the current window to fit screen if it is not already maximized")
```
Example usage:

```clj
(:use clj-webdriver.taxi)
(:require [clj-webdriver.window :as win])

(def driver (new-driver {:browser :firefox}))

(win/resize! driver {:width 480 :height 800})
(win/position driver) => {:x 34 :y 56}
(win/size driver) => {:width 480 :height 800}
```

`clj-webdriver.test.window` namespace contains passing tests. I didn't add that namespace to the `clj-webdriver.test.runner` or to the bash script as I didn't know which or if both will be used moving forward.