Forked from andidev/WebDriverExtensionsGroovyExampleTest.groovy
Created
June 27, 2017 09:55
-
-
Save swapnilshrikhande/1ce1a40c1a8a9726590c905dded6cfa7 to your computer and use it in GitHub Desktop.
Example of a WebDriver Extensions Test written in Groovy
This file contains hidden or 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
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.openqa.selenium.support.FindBy; | |
import org.openqa.selenium.WebElement; | |
import com.github.webdriverextensions.junitrunner.WebDriverRunner; | |
import com.github.webdriverextensions.junitrunner.annotations.*; | |
import static com.github.webdriverextensions.Bot.*; | |
import static java.util.concurrent.TimeUnit.SECONDS; | |
@Grab(group='com.github.webdriverextensions', module='webdriverextensions', version='3.3.0') | |
@RunWith(WebDriverRunner) | |
@Firefox | |
@Chrome | |
@InternetExplorer | |
class WebDriverExtensionsGroovyExampleTest { | |
@FindBy(name = "q") | |
WebElement queryInput; | |
@FindBy(name = "btnG") | |
WebElement searchButton; | |
@FindBy(id = "search") | |
WebElement searchResult; | |
@Test | |
void searchGoogleForHelloWorldTest() { | |
open "http://www.google.com" | |
assertCurrentUrlContains "google" | |
type "Hello World", queryInput | |
click searchButton | |
waitFor 3, SECONDS | |
assertTextContains "Hello World", searchResult | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment