Commits

Miki Tebeka committed 3d6fda3 Merge

Merge with default

  • Participants
  • Parent commits eaa1455, 81c7f40
  • Branches parallel-test

Comments (0)

Files changed (5)

 	}
 	log.Printf(format+"\n", args...)
 }
-
+/*
+Selenium/Webdriver client.
+
+Currently provides only WebDriver remote client.
+This means you'll need to run the Selenium server by yourself (or use a service
+like SauceLabs). The easiest way to do that is to grab the Selenium server jar
+from http://selenium.googlecode.com/files and run it
+	java -jar selenium-server-standalone-2.24.1.jar
+
+Example usage:
+
+	// Run some code on play.golang.org and display the result
+	package main
+
+	import (
+		"fmt"
+		"time"
+
+		"bitbucket.org/tebeka/selenium"
+	)
+
+	var code string = `
+	package main
+	import "fmt"
+
+	func main() {
+		fmt.Println("Hello WebDriver!\n")
+	}
+	`
+
+	// Errors are ignored for brevity.
+
+	func main() {
+		// FireFox driver without specific version
+		caps := selenium.Capabilities{"browserName": "firefox"}
+		wd, _ := selenium.NewRemote(caps, "")
+		defer wd.Quit()
+
+		// Get simple playground interface
+		wd.Get("http://play.golang.org/?simple=1")
+
+		// Enter code in textarea
+		elem, _ := wd.FindElement(selenium.ByCSSSelector, "#code")
+		elem.Clear()
+		elem.SendKeys(code)
+
+		// Click the run button
+		btn, _ := wd.FindElement(selenium.ByCSSSelector, "#run")
+		btn.Click()
+
+		// Get the result
+		div, _ := wd.FindElement(selenium.ByCSSSelector, "#output")
+
+		output := ""
+		// Wait for run to finish
+		for {
+			output, _ = div.Text()
+			if output != "Waiting for remote server..." {
+				break
+			}
+			time.Sleep(time.Millisecond * 100)
+		}
+
+		fmt.Printf("Got: %s\n", output)
+	}
+*/
+package selenium
 
 /* Create new remote client, this will also start a new session.
    capabilities - the desired capabilities, see http://goo.gl/SNlAk
-   executor - the URL to the Selenim server, *must* be prefixed with protocol (http,https...)
+   executor - the URL to the Selenim server, *must* be prefixed with protocol (http,https...).
+              Empty string means DEFAULT_EXECUTOR
 */
 func NewRemote(capabilities Capabilities, executor string) (WebDriver, error) {
 
-/* Selenium/Webdriver client.
-
-Currently provides only WebDriver remote client.
-
-*/
 package selenium
 
 import (
 
 pidfile=/tmp/selenium.pid
 log=/tmp/selenium.log
-jar=selenium-server-standalone-2.21.0.jar
+jar=selenium-server-standalone-2.25.0.jar
 url=http://selenium.googlecode.com/files/$jar
 
 start() {