Selenium Example which takes screenshot as well the source code

  Below is a piece of code which 1. navigates thru some craigslist pages 2. Takes a image screenshot and save it to a file 3. Saves the source code into a file 4. Pauses briefly for user to review the page   import org.openqa.selenium.By; import org.openqa.selenium.OutputType; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.ui.ExpectedCondition;…

Read More

Geb simple browser example

This is how to work with a chrombrowser instance:    package org.ragin.test import spock.lang.* import geb.Browser import org.openqa.selenium.chrome.* import org.openqa.selenium.firefox.FirefoxDriver class GebSpec extends spock.lang.Specification { // run before the first feature method def setupSpec() { println "These are browser tests" System.setProperty("webdriver.chrome.driver", "E:\\Dev\\chromedriver\\chromedriver.exe"); } // run after the last feature method def cleanupSpec() { } //…

Read More