Created
March 3, 2020 15:33
-
-
Save NickBaynham/a71b713ffd9b279b35df6ef7427985bb to your computer and use it in GitHub Desktop.
Registration Test with Raw Selenium API Calls
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
| package selfHealingExamples.tests.registration; | |
| import org.openqa.selenium.By; | |
| import org.testng.annotations.Test; | |
| import static org.testng.AssertJUnit.assertEquals; | |
| public class RegistrationSelenium extends BaseTest { | |
| @Test | |
| public void TestRegistration() { | |
| getDriver().get("http://localhost:7800/bootstrap1.html#"); | |
| getDriver().findElement(By.xpath("//label[contains(.,'First name')]/../input")).sendKeys("Ada"); | |
| getDriver().findElement(By.xpath("//label[contains(.,'Last name')]/../input")).sendKeys("Lovelace"); | |
| getDriver().findElement(By.xpath("//label[contains(.,'Username')]/..//input")).sendKeys("ALovelace"); | |
| getDriver().findElement(By.xpath("//label[contains(.,'City')]/../input")).sendKeys("Orlando"); | |
| getDriver().findElement(By.xpath("//label[contains(.,'State')]/../input")).sendKeys("FL"); | |
| getDriver().findElement(By.xpath("//label[contains(.,'Zip')]/../input")).sendKeys("32832"); | |
| getDriver().findElement(By.xpath("//label[contains(.,'Agree to terms and conditions')]/../input")).click(); | |
| getDriver().findElement(By.xpath("//button[contains(.,'Register')]")).click(); | |
| assertEquals(getDriver().getTitle(), "Self Healing Test Page"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment