Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package attemptOne;
- import com.github.javafaker.Faker;
- import com.github.javafaker.PhoneNumber;
- import org.junit.Assert;
- import org.junit.Test;
- import org.openqa.selenium.By;
- import org.openqa.selenium.WebDriver;
- import org.openqa.selenium.WebElement;
- import org.openqa.selenium.chrome.ChromeDriver;
- import org.openqa.selenium.firefox.FirefoxDriver;
- import org.openqa.selenium.support.ui.Select;
- import java.sql.Driver;
- public class demoqa {
- @Test
- public void startWebDriver() {
- System.setProperty("webdriver.gecko.driver", "C:\\Program Files\\SeleniumGe\\geckodriver.exe");
- WebDriver driver = new FirefoxDriver();
- driver.get("http://demoqa.com/registration/"); //go to the adress
- Faker faker = new Faker();
- String FirstName = faker.name().firstName();
- String LastName = faker.name().lastName();
- String email = faker.internet().emailAddress();
- String username = faker.name().username();
- String aboutyourself = faker.name().username();
- String password = faker.internet().password();
- WebElement FirstNameTextBox = driver.findElement(By.id("name_3_firstname"));
- FirstNameTextBox.sendKeys(FirstName);
- WebElement LastNameTextBox = driver.findElement(By.id("name_3_lastname"));
- LastNameTextBox.sendKeys(LastName);
- WebElement emailTextBox = driver.findElement(By.id("email_1"));
- emailTextBox.sendKeys(email);
- WebElement UsernameTextBox = driver.findElement(By.id("username"));
- UsernameTextBox.sendKeys(username);
- WebElement YourselfTextBox = driver.findElement(By.id("description"));
- YourselfTextBox.sendKeys(aboutyourself);
- WebElement passwordfield = driver.findElement(By.id("password_2"));
- passwordfield.sendKeys(password);
- WebElement confirmpasswordfield = driver.findElement(By.id("confirm_password_password_2"));
- confirmpasswordfield.sendKeys(password);
- Select oSelect = new Select(driver.findElement(By.id("yy_date_8")));
- oSelect.selectByVisibleText("2010");
- Select oSelect2 = new Select(driver.findElement(By.id("dd_date_8")));
- oSelect2.selectByVisibleText("10");
- Select oSelect3 = new Select(driver.findElement(By.id("mm_date_8")));
- oSelect3.selectByVisibleText("5");
- Select oSelect4 = new Select(driver.findElement(By.id("dropdawn_7")));
- oSelect4.selectByVisibleText("Albania");
- WebElement hobbyButton = driver.findElement(By.cssSelector("#pie_register > li:nth-child(3) > div > div.radio_wrap > input:nth-child(6)"));
- hobbyButton.click();
- WebElement MaritalButton = driver.findElement(By.cssSelector("#pie_register > li:nth-child(2) > div > div > input:nth-child(2)"));
- MaritalButton.click();
- driver.close();
- }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement