Monday, May 13, 2013

Take photo by WebDriver in Grails

Some steps:
1. Download Selenium
2. Code to take photo

Start.
1. Download Selenium.
Please access this link to download selenium.http://code.google.com/p/selenium/downloads/detail?name=selenium-server-standalone-2.32.0.jar&can=2&q=
After that copy it to lib folder of grails.

2. Code to take photo.

WebDriver driver = new FirefoxDriver();
driver.get(grailsApplication?.config.grails.serverURL + "/${nickname}/profile");
File file = driver.getScreenshotAs(OutputType.FILE);
driver.close()
println(file.toString());


Good luck to you.

No comments:

Post a Comment