With this plugin you can use Geb with a PhantomJS headless browser in your automation scripts. Automatically downloads the PhantomJS binaries for your OS (supporting Linux 64/32, Windows and Mac OS).
The GebTask
has a drive()
method taking a closure, just like Geb's drive method.
See Geb's NavigableSupport and Navigator API for information on how to interact with web content.
Useful for quick and dirty automation, once all dependencies are downloaded.
buildscript {
repositories { jcenter() }
dependencies { classpath "de.thokari:gradle-geb-plugin:0.4" }
}
apply plugin: 'geb'
import de.thokari.gradle.tasks.*
task duckDuckGoSearch(type: GebTask) << {
drive {
go 'https://www.duckduckgo.com'
println $('#tagline_homepage').text()
$('#search_form_input_homepage') << 'wikipedia'
$('#search_button_homepage').click()
println $('a.large')*.text().join('\n')
}
}