Created
June 1, 2013 08:29
-
-
Save koizuss/5689688 to your computer and use it in GitHub Desktop.
setup webdriver on gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ext { | |
webdriver { | |
chrome { | |
driver = file('tools/chromedriver/chromedriver') | |
} | |
} | |
} | |
task setupChromeDriver << { | |
ext { | |
src = 'https://chromedriver.googlecode.com/files/chromedriver2_mac32_0.9.zip' | |
dest = file(webdriver.chrome.driver.parent + '/archives') | |
zipfile = new File(dest.path, src.split('/')[-1]) | |
} | |
if(!dest.exists()) assert dest.mkdirs(), "mkdir failed [$dest]" | |
if(!zipfile.exists()) ant.get(src: src, dest: dest, verbose: true) | |
assert zipfile.exists(), "download failed [$src]" | |
copy { | |
from zipTree(zipfile) | |
into webdriver.chrome.driver.parent | |
}.execute() | |
} | |
task setup(dependsOn: setupChromeDriver) | |
test.doFirst { | |
systemProperty 'webdriver.chrome.driver', chromeDriver | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This will work only on a mac. Getting it to work on linux, mac and windows is going to be tedious