Skip to content

Instantly share code, notes, and snippets.

@bufferings
Last active April 5, 2018 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bufferings/a8980ea515a893e21a3a95955ace5dc9 to your computer and use it in GitHub Desktop.
Save bufferings/a8980ea515a893e21a3a95955ace5dc9 to your computer and use it in GitHub Desktop.
import org.openqa.selenium.Platform;
import org.openqa.selenium.remote.BrowserType;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
driver = {
def capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, BrowserType.FIREFOX);
capabilities.setCapability(CapabilityType.PLATFORM_NAME, Platform.LINUX);
capabilities.setCapability("screenResolution", "1280x720");
capabilities.setCapability("tz", "Asia/Tokyo");
def remoteWebDriverUrl = new URL("http://localhost:4444/wd/hub")
new RemoteWebDriver(remoteWebDriverUrl, capabilities)
}
@Grapes([
@Grab("org.gebish:geb-core:2.1"),
@Grab("org.seleniumhq.selenium:selenium-chrome-driver:3.11.0"),
@Grab("org.seleniumhq.selenium:selenium-support:3.11.0")
])
import geb.Browser
Browser.drive {
go "http://gebish.org"
assert title == "Geb - Very Groovy Browser Automation"
$("div.menu a.manuals").click()
waitFor { !$("#manuals-menu").hasClass("animating") }
$("#manuals-menu a")[0].click()
assert title.startsWith("The Book Of Geb")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment