Skip to content

Instantly share code, notes, and snippets.

@Dispader
Created April 30, 2016 10:44
Show Gist options
  • Save Dispader/4eeb8b65b5135aacb87db1bbfcf61b94 to your computer and use it in GitHub Desktop.
Save Dispader/4eeb8b65b5135aacb87db1bbfcf61b94 to your computer and use it in GitHub Desktop.
a simple `groovysh` session, driving a Firefox browser with WebDriver
groovy:000> import org.openqa.selenium.*
===> org.openqa.selenium.firefox.*, org.openqa.selenium.*
groovy:000> import org.openqa.selenium.firefox.*
===> org.openqa.selenium.*, org.openqa.selenium.firefox.*
groovy:000> driver = new FirefoxDriver() as WebDriver
===> FirefoxDriver: firefox on MAC (1b117b7b-c930-f642-8273-206cb455eedb)
groovy:000> driver.get('http://google.com')
===> null
groovy:000> searchBox = driver.findElement(By.id('lst-ib'))
===> [[FirefoxDriver: firefox on MAC (1b117b7b-c930-f642-8273-206cb455eedb)] -> id: lst-ib]
groovy:000> searchBox.sendKeys('webdriver')
===> null
groovy:000> driver.findElement(By.name('btnG')).click()
===> null
groovy:000> 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment