public void testViewMacronutrientsAsHCP() throws Exception {
    // Login patient 1.
    WebDriver wd = (HtmlUnitDriver) login("9000000071", "pw");
    assertEquals("iTrust - HCP Home", wd.getTitle());

    // Navigate to the Macronutrients page.
    wd.findElement(By.partialLinkText("Patient Macronutrient")).click();
    assertEquals("iTrust - Please Select a Patient", wd.getTitle());
    wd.findElement(By.name("UID_PATIENTID")).sendKeys("342");
    // the button to click should have the text of the MID
    wd.findElement(By.cssSelector("input[value='342']")).submit();

    assertTrue(
        wd.findElement(By.tagName("body"))
            .getText()
            .contains("Hubert Farnsworth's Macronutrient Intake"));

    wd = (HtmlUnitDriver) login("9000000000", "pw");
    assertEquals("iTrust - HCP Home", wd.getTitle());

    // Navigate to the Macronutrients page.
    wd.findElement(By.partialLinkText("Patient Macronutrient")).click();
    assertEquals("iTrust - Please Select a Patient", wd.getTitle());
    wd.findElement(By.name("UID_PATIENTID")).sendKeys("342");
    // the button to click should have the text of the MID
    wd.findElement(By.cssSelector("input[value='342']")).submit();

    assertTrue(
        wd.findElement(By.tagName("body"))
            .getText()
            .contains("You do not have permission to view the Food Diary!"));
  }
  @Test
  public void testConfigureSystem() throws Exception {
    if (runSkip.equalsIgnoreCase("x")) {
      // Set the initial state
      driver.get("http://localhost:8080");

      // Copy in code here
      driver.findElement(By.linkText("Jenkins")).click();
      driver.findElement(By.linkText("Manage Jenkins")).click();
      driver.findElement(By.linkText("Configure System")).click();
      if (!numOfExecutors.equals("")) {
        driver.findElement(By.name("_.numExecutors")).clear();
        driver.findElement(By.name("_.numExecutors")).sendKeys(numOfExecutors);
      }
      // driver.findElement(By.id("cb4")).click();
      setCheckbox("cb4", restrictProjectNaming);
      setNamingStrategy(namingStrategy);
      new Select(driver.findElement(By.cssSelector("select.setting-input.dropdownList")))
          .selectByVisibleText(mavenDefaultSettings);
      if (!mavenFilePath.equals("")) {
        driver.findElement(By.name("_.path")).clear();
        driver.findElement(By.name("_.path")).sendKeys(mavenFilePath);
      }
      driver.findElement(By.id("yui-gen10-button")).click();
    }
  }
 @Init
 public void init() {
   fieldConfigurationSchemeId = find(By.name("id"));
   issueTypeDropdown = find(By.name("issueTypeId"), SelectElement.class);
   fieldConfigurationDropdown = find(By.name("fieldConfigurationId"), SelectElement.class);
   submit = find(By.name("Add"));
 }
 private void login() {
   driver.findElement(By.id("username")).clear();
   driver.findElement(By.id("username")).sendKeys("GSH8");
   driver.findElement(By.name("j_password")).clear();
   driver.findElement(By.name("j_password")).sendKeys("GSH");
   driver.findElement(By.xpath("//input[@value='LOGAR']")).click();
 }
  @Test
  public void testEditXidioAddressInProfileManagement() throws Exception {
    UserLoginFunctions userLogin = new UserLoginFunctions();
    driver.get(AppProperties.APPURL);

    assertTrue(
        driver
            .findElement(By.cssSelector("BODY"))
            .getText()
            .matches("^[\\s\\S]*Sign In[\\s\\S]*$"));

    userLogin.UserLoginCredentials(driver);

    driver.findElement(By.linkText(AppProperties._USER_NAME)).click();
    driver.findElement(By.name("user[address]")).clear();
    driver.findElement(By.name("user[address]")).sendKeys(AppProperties._UPD_ADDRESS);
    driver.findElement(By.linkText("Save profile")).click();

    assertTrue(
        driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*XIDIO[\\s\\S]*$"));
    driver.findElement(By.linkText(AppProperties._USER_NAME)).click();
    driver.findElement(By.linkText("Sign out")).click();

    assertTrue(
        driver
            .findElement(By.cssSelector("BODY"))
            .getText()
            .matches("^[\\s\\S]*User Account[\\s\\S]*$"));
    assertEquals(
        AppProperties._UPD_ADDRESS,
        driver.findElement(By.name("user[address]")).getAttribute("value"));
  }
 @Test
 public void testReserveringBevestigen() throws Exception {
   driver.get(baseUrl + "/Themaopdracht/loginpage.jsp");
   driver.findElement(By.name("username")).clear();
   driver.findElement(By.name("username")).sendKeys("Henk");
   driver.findElement(By.name("password")).clear();
   driver.findElement(By.name("password")).sendKeys("hww");
   driver.findElement(By.cssSelector("input[type=\"submit\"]")).click();
   driver.get("http://*****:*****@name='knop'])[2]")).click();
   driver.findElement(By.cssSelector("#content > form > p > input[name=\"knop\"]")).click();
   assertEquals(
       "De reservering is succesvol bevestigd",
       driver.findElement(By.cssSelector("h3.msg > span")).getText());
   driver.findElement(By.xpath("(//input[@name='knop'])[2]")).click();
   assertTrue(isElementPresent(By.cssSelector("h3.error")));
   driver.findElement(By.name("zoekviaID")).clear();
   driver.findElement(By.name("zoekviaID")).sendKeys("abc");
   driver.findElement(By.xpath("(//input[@name='knop'])[2]")).click();
   assertTrue(isElementPresent(By.cssSelector("h3.error")));
   driver.findElement(By.name("zoekviaID")).clear();
   driver.findElement(By.name("zoekviaID")).sendKeys("1");
   driver.findElement(By.xpath("(//input[@name='knop'])[2]")).click();
   assertTrue(isElementPresent(By.cssSelector("h3.error")));
 }
  /** Tests subscription successfully */
  @Test
  public void testSubscriptionSuccessfully() {
    String formUrl = "http://*****:*****@type='email']")).sendKeys("aaa@aa");

    // enter name
    getDriver().findElement(By.name("name")).sendKeys("name");

    // tick keep posted
    getDriver().findElement(By.name("keepposted")).click();

    // click send
    getDriver().findElement(By.xpath("//button[@type='submit']")).click();
    pause(3);

    // Checking
    assertTrue(getDriver().findElement(By.className("name-success")) != null);
    assertTrue(
        getDriver()
            .findElement(By.xpath("//p[@class='name-success']/b/i"))
            .getText()
            .equals("name"));
    assertTrue(getDriver().findElement(By.className("subscription-success")) != null);
    assertTrue(
        getDriver()
            .findElement(By.xpath("//p[@class='subscription-success']/i/b"))
            .getText()
            .equals("aaa@aa"));
  }
Beispiel #8
0
 public void login(Admin admin) {
   // driver.get(baseUrl + "/mantisbt-1.2.19/login_page.php");
   openUrl("/");
   type(By.name("username"), admin.login);
   type(By.name("password"), admin.password);
   click(By.cssSelector("input.button"));
 }
 public ProviderPage(WebDriver driver) {
   super(driver);
   MANAGE = By.linkText("Manage Providers");
   ADD = By.linkText("Add Provider");
   RETIRE = By.name("retireProviderButton");
   SAVE = By.name("saveProviderButton");
 }
  /** Tests subscription if name field is empty */
  @Test
  public void testSubscriptionWithoutName() {

    String formUrl = "http://*****:*****@type='email']")).sendKeys("aaa@aa");

    // tick keep posted
    getDriver().findElement(By.name("keepposted")).click();

    // click send
    getDriver().findElement(By.xpath("//button[@type='submit']")).click();
    pause(3);

    // Checking
    // page url did not changed
    assertTrue(getDriver().findElement(By.xpath("//div[@role='alert']")) != null);
  }
  @When("^틴캐시 결제수단을 선택한다$")
  public void 틴캐시_결제수단을_선택한다() throws Throwable {
    // 라디오 버튼 사용으로 상품권 선택
    WebElement petrol =
        driver.findElement(
            By.xpath("//*[@id='common']/table/tbody/tr[2]/td/ul[2]/li[1]/span/input"));

    if (!petrol.isSelected()) petrol.click();

    assertTrue(petrol.isSelected());

    // 라디오 그룹 자동화 테스트
    List<WebElement> fuel_type = (List<WebElement>) driver.findElements(By.name("spgid"));
    for (WebElement type : fuel_type) {
      if (type.getAttribute("value").equals("gift")) {
        if (!type.isSelected()) type.click();
        assertTrue(type.isSelected());
        break;
      }
    }

    Select make = new Select(driver.findElement(By.name("spgid_gift")));
    assertFalse(make.isMultiple());
    make.selectByVisibleText("틴캐시");
    assertEquals("틴캐시", make.getFirstSelectedOption().getText());
  }
public class ConfirmYourNumberPopUpScreen extends AppiumLibrary {

  public static By Confirm_Your_Number_Lbl = By.name("Confirm your number");
  // public static By MSISDN_Lbl=By.name("+919540752593");   MSISDN should be passes in a variable
  // here
  public static By cancelButton = By.name("Cancel");
  public static By confirmButton = By.name("Confirm");

  public static By getConfirmButton() {
    return confirmButton;
  }

  public static By getCancelButton() {
    return cancelButton;
  }

  public static PinEnteringScreen clickOnConfirmButton() {
    clickOnElement(confirmButton);
    return new PinEnteringScreen();
  }

  public static LoginPhoneNumberScreen clickOnCancelButton() {

    clickOnElement(cancelButton);
    return new LoginPhoneNumberScreen();
  }
}
Beispiel #13
0
 @BeforeClass
 public static void loginAsAdmin() {
   s.open("/logout.action");
   s.type(By.name("username"), "admin");
   s.type(By.name("password"), "admin");
   s.click(By.id("submit_btn"));
 }
 private void doLogin(String username, String password) {
   driver.findElement(By.name("login")).sendKeys(username);
   driver.findElement(By.name("password")).sendKeys(password);
   driver.findElement(By.cssSelector("input.login")).click();
   assertEquals(
       "Message not found",
       "Logged in successfully.",
       driver.findElement(By.id("message")).getText());
 }
Beispiel #15
0
 /**
  * @param username
  * @param password
  * @throws TimeoutException
  * @throws NoSuchElementException
  */
 public void login(String username, String password)
     throws NoSuchElementException, TimeoutException {
   //		WebElement userName_editbox = driver.findElement(By.name("loginName"));
   WebElement userName_editbox = fluentWait(By.name("loginName"));
   WebElement password_editbox = driver.findElement(By.name("password"));
   userName_editbox.sendKeys(username);
   password_editbox.sendKeys(password);
   password_editbox.submit();
 }
Beispiel #16
0
  public void loginWithCredentials(String username, String password) {
    final WebElement usernameField = driver.findElement(By.name("username"));
    final WebElement passwordField = driver.findElement(By.name("password"));
    final WebElement loginForm = driver.findElement(By.tagName("form"));

    usernameField.sendKeys(username);
    passwordField.sendKeys(password);
    loginForm.submit();
  }
  public void login() {
    driver.findElement(By.name("username")).sendKeys("qacharutest.1006");
    driver.findElement(By.name("password")).sendKeys("Pass1234!");
    driver.findElements(By.cssSelector(".btn.btn-lg.btn-primary.btn-block")).get(0).click();

    WebElement myDynamicElement =
        (new WebDriverWait(driver, 10))
            .until(ExpectedConditions.presenceOfElementLocated(By.id("navbar")));
  }
 @Test
 public void disableRecurringSearch() {
   driver.findElement(By.id("searchFormSignInLink")).click();
   WebElement login =
       (new WebDriverWait(driver, 10))
           .until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[.='Sign In']")));
   try {
     Thread.sleep(500);
   } catch (InterruptedException e) {
     e.printStackTrace();
   }
   Assert.assertNotNull(login);
   driver.findElement(By.name("email")).sendKeys("*****@*****.**");
   driver.findElement(By.name("password")).sendKeys("qwert");
   driver.findElement(By.id("loginFormLoginButton")).click();
   WebElement element =
       (new WebDriverWait(driver, 10))
           .until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[.='Map']")));
   try {
     Thread.sleep(500);
   } catch (InterruptedException e) {
     e.printStackTrace();
   }
   Assert.assertNotNull(element);
   driver.findElement(By.className("mainTabsSettings")).click();
   WebElement click =
       (new WebDriverWait(driver, 10))
           .until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[.='Map']")));
   try {
     Thread.sleep(500);
   } catch (InterruptedException e) {
     e.printStackTrace();
   }
   Assert.assertNotNull(click);
   driver.findElement(By.className("settingNavigationViewRecurringView")).click();
   WebElement check =
       (new WebDriverWait(driver, 10))
           .until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[.='Map']")));
   try {
     Thread.sleep(500);
   } catch (InterruptedException e) {
     e.printStackTrace();
   }
   Assert.assertNotNull(check);
   driver.findElement(By.name("disableDialog")).click();
   WebElement tick =
       (new WebDriverWait(driver, 10))
           .until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[.='Map']")));
   try {
     Thread.sleep(500);
   } catch (InterruptedException e) {
     e.printStackTrace();
   }
   Assert.assertNotNull(tick);
   driver.findElement(By.id("settingNavigationViewBack")).click();
 }
Beispiel #19
0
  @Test
  public void testSearchFeature() {

    // find search, check if search works by sending a search time, see that results exist

    WebElement element = driver.findElement(By.name("search_block_form"));
    element.sendKeys("Laboon");
    element.sendKeys(Keys.RETURN);
    assert (driver.findElement(By.name("Laboon")) != null); // is it good enough?
  }
 @Test
 @Ignore
 public void testLoginFailsWithBadCredentials() throws Exception {
   String userName = getUniqueId();
   String password = getUniqueId();
   driver.findElement(By.name("login")).sendKeys(userName);
   driver.findElement(By.name("password")).sendKeys(password);
   driver.findElement(By.cssSelector("input.login")).click();
   assertNotNull("Text not found", driver.findElement(By.id("message")));
 }
 @Test
 public void testLoginMaster2() throws Exception {
   driver.get(baseUrl + "/login.html");
   driver.findElement(By.name("j_username")).clear();
   driver.findElement(By.name("j_username")).sendKeys("*****@*****.**");
   driver.findElement(By.name("j_password")).clear();
   driver.findElement(By.name("j_password")).sendKeys("master");
   driver.findElement(By.xpath("//input[@value='Login']")).click();
   driver.findElement(By.linkText("Sign out")).click();
 }
  public void lance(String usuario, double valor) {
    WebElement txtValor = driver.findElement(By.name("lance.valor"));
    WebElement combo = driver.findElement(By.name("lance.usuario.id"));
    Select cbUsuario = new Select(combo);

    cbUsuario.selectByVisibleText(usuario);
    txtValor.sendKeys(String.valueOf(valor));

    driver.findElement(By.id("btnDarLance")).click();
  }
 @Test
 public void testBookSearch5() throws Exception {
   driver.get(baseUrl + "/proyectoBiblioteca/");
   new Select(driver.findElement(By.name("type"))).selectByVisibleText("Editorial");
   driver.findElement(By.name("search")).clear();
   driver.findElement(By.name("search")).sendKeys("De Bolsillo");
   driver.findElement(By.xpath("//button[@type='submit']")).click();
   assertEquals(
       "Libros Encontrados", driver.findElement(By.cssSelector("div.panel-heading")).getText());
 }
Beispiel #24
0
  public static void main(String[] args) throws Exception {

    // Step1
    WebDriver wd = new FirefoxDriver(); // we have created an object wd
    WebDriverWait wait = new WebDriverWait(wd, 60);

    // Step2
    wd.get("http://www.orbitz.com");

    // Step3
    wd.findElement(By.xpath("//input[@name='search.type']")).click();
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("ar.rt.leaveSlice.orig.key")));

    /*
     * Wait will ignore instances of NotFoundException that are encountered (thrown) by default in the 'until'
     * condition, and immediately propagate all others.
     */

    // Step4
    wd.findElement(By.name("ar.rt.leaveSlice.orig.key")).clear();

    // Step5
    wd.findElement(By.name("ar.rt.leaveSlice.orig.key")).sendKeys("DFW");

    // Step6
    wd.findElement(By.name("ar.rt.leaveSlice.dest.key")).clear();

    // Step7
    wd.findElement(By.name("ar.rt.leaveSlice.dest.key")).sendKeys("SFO");

    // Step8
    wd.findElement(By.name("ar.rt.leaveSlice.date")).clear();

    // Step9
    wd.findElement(By.name("ar.rt.leaveSlice.date")).sendKeys("11/19/15");

    // Step10
    wd.findElement(By.name("ar.rt.returnSlice.date")).clear();

    // Step11
    wd.findElement(By.name("ar.rt.returnSlice.date")).sendKeys("11/20/15");

    // Step12
    wd.findElement(By.name("search")).click();
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("sortResultsSelect")));

    // Step13
    String price =
        wd.findElement(By.xpath(".//*[@id='matrix']/div[1]/div/div/span"))
            .getText()
            .replace("$", "");
    System.out.println("The lowest price is: " + price);

    wd.close();
  }
Beispiel #25
0
  /** 登录错误的用户名密码. */
  @Test
  public void loginWithWrongPassword() {
    s.open("/logout");
    s.type(By.name("username"), "wrongUser");
    s.type(By.name("password"), "WrongPassword");
    s.check(By.name("rememberMe"));
    s.click(By.id("submit_btn"));

    assertEquals("MyProject示例:登录页", s.getTitle());
    assertTrue(s.isTextPresent("登录失败,请重试."));
  }
  private void submit(WebDriver driver) {
    WebElement submitButton = driver.findElement(By.name("button"));
    driver.manage().timeouts().implicitlyWait(waitTimeout, TimeUnit.SECONDS);

    submitButton.click();

    WebElement awsForm = driver.findElement(By.name("awsForm"));
    //		System.out.println(awsForm.toString());
    driver.manage().timeouts().implicitlyWait(waitTimeout, TimeUnit.SECONDS);
    awsForm.submit();
  }
  /** 登录管理员, 如果用户还没有登录. */
  protected static void loginAsUserIfNecessary() {
    s.open("/task");

    if ("main示例:登录页".equals(s.getTitle())) {
      s.type(By.name("username"), "user");
      s.type(By.name("password"), "user");
      s.check(By.name("rememberMe"));
      s.click(By.id("submit_btn"));
      assertEquals("main示例:任务管理", s.getTitle());
    }
  }
 @Init
 public void init() {
   formElement = locator.find(formLocator);
   nameElement = formElement.find(By.name("name"));
   descriptionElement = formElement.find(By.name("description"));
   addButton = formElement.find(By.name("Add"));
   issueTypeRadio = formElement.find(By.cssSelector("input.radio[value='']"));
   subtaskRadio = formElement.find(By.cssSelector("input.radio[value='jira_subtask']"));
   cancelLink = formElement.find(By.cssSelector("a.cancel"));
   iconPicker = pageBinder.bind(IconPicker.class, "issue-type-icon-picker");
 }
 @Test
 public void switchToFrameByElement() {
   WebDriver d = getDriver();
   d.get("http://docs.wpm.neustar.biz/testscript-api/index.html");
   assertEquals("__MAIN_FRAME__", getCurrentFrameName(d));
   d.switchTo().frame(d.findElement(By.name("packageFrame")));
   assertEquals("packageFrame", getCurrentFrameName(d));
   d.switchTo().defaultContent();
   assertEquals("__MAIN_FRAME__", getCurrentFrameName(d));
   d.switchTo().frame(d.findElement(By.name("packageFrame")));
   assertEquals("packageFrame", getCurrentFrameName(d));
 }
 public _02_Login zEnterCrediantials(String UserNameTxt, String PasswordTxt)
     throws InterruptedException {
   Wait(3000);
   driver.findElement(By.name("userName")).sendKeys(UserNameTxt);
   driver.findElement(By.name("password")).sendKeys(UserNameTxt);
   // driver.findElement(By.name("login")).click();
   click(driver.findElement(By.name("login")));
   Print("UserName:"******"---Login");
   Wait(3000);
   return this;
 }