Created
April 19, 2018 07:58
-
-
Save shapovalovei/d510d879b70334c5285cf439e2de5071 to your computer and use it in GitHub Desktop.
headless chrome
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 io.trueautomation.client.driver.TrueAutomationDriver; | |
| import org.openqa.selenium.By; | |
| import org.openqa.selenium.WebDriver; | |
| import org.openqa.selenium.chrome.ChromeOptions; | |
| import org.testng.annotations.AfterTest; | |
| import org.testng.annotations.BeforeTest; | |
| import org.testng.annotations.Test; | |
| import java.net.MalformedURLException; | |
| import java.util.concurrent.TimeUnit; | |
| import static io.trueautomation.client.TrueAutomationHelper.ta; | |
| public class exampleTest { | |
| private WebDriver driver; | |
| private By loginBtn = By.cssSelector(ta("loginBtn", "a.login-btn")); | |
| private By signupBtn = By.cssSelector(ta("signupBtn", "div.sign-up-container > a")); | |
| private By emailFl = By.name(ta("emailFl", "email")); | |
| @BeforeTest | |
| public void beforeTest() throws MalformedURLException { | |
| driver = new TrueAutomationDriver(new ChromeOptions().setHeadless(true)); | |
| driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS); | |
| } | |
| @Test | |
| public void exampleTest() { | |
| driver.get("https://trueautomation.io"); | |
| driver.findElement(loginBtn).click(); | |
| driver.findElement(signupBtn).click(); | |
| driver.findElement(emailFl).sendKeys("[email protected]"); | |
| } | |
| @AfterTest | |
| public void afterTest() { | |
| driver.quit(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment