コード例 #1
0
  @Ignore
  @Test
  public void TestCase_002() throws Exception {

    LogGenerator.addLog(Level.INFO, "Starting Test Case_002");

    driver.get("http://www.google.com");
    String name = (new Exception().getStackTrace()[0].getMethodName());
    CaptureScreenshot.takeScreenshot(driver, name);

    // Find the text input element by its name
    WebElement element = driver.findElement(By.name("q"));
    element.sendKeys("Junit");
    element.submit();

    synchronized (driver) {
      driver.wait(12000);
    }

    LogGenerator.addLog(Level.INFO, "my info message in test case 002");

    CaptureScreenshot.takeScreenshot(driver, name);
    // assertEquals("junit - Google Search", driver.getTitle());

    LogGenerator.addLog(Level.INFO, "Completing Test Case_002");
  }
コード例 #2
0
  @Ignore
  @Test
  public void TestCase_00X() throws Exception {
    LogGenerator.addLog(Level.INFO, "Starting Test Case_00X");
    driver.get("http://myitlabgrader.com/HTML5/SIMFrame.html");
    synchronized (driver) {
      driver.wait(6000);
    }

    driver.findElement(By.id("viewallbutton")).click();
    driver.findElement(By.xpath("//div[@id='ViewAllDlg']/div/table/tbody/tr[5]/td[2]")).click();
    driver.findElement(By.xpath("(//button[@type='button'])[2]")).click();
    driver
        .findElement(By.xpath("//div[@class='excelWorkBook']/div/div/div[2]/ul[3]/li[2]/div"))
        .click();

    ((JavascriptExecutor) driver)
        .executeScript("$('div#12_selectionBorder1.selectionBorderDiv').dblclick();");
    //
    // ((JavascriptExecutor)driver).executeScript("$('div#12_selectionBorder1.selectionBorderDiv').focus();")  ;

    driver.findElement(By.xpath("//*[@id='12_editableDiv1']/div")).sendKeys("Semester 1");
    //
    //	driver.findElement(By.xpath("//div[@class='excelWorkBook']/div/div/div[2]/ul[3]/li[4]/div")).click();

    driver.findElement(By.xpath("//*[@id='12_editableDiv1']/div")).sendKeys(Keys.RETURN);

    //					 ((JavascriptExecutor)driver).executeScript("$('div#12_editableDiv1').keypress(function
    // (e){if(e.keyCode == 13) });")  ;
    synchronized (driver) {
      driver.wait(6000);
    }
    String name = (new Exception().getStackTrace()[0].getMethodName());
    CaptureScreenshot.takeScreenshot(driver, name);
  }
コード例 #3
0
  @Ignore
  @Test
  public void TestCase_003() throws Exception {

    LogGenerator.addLog(Level.INFO, "Starting Test Case_003");
    driver.get("http://grader3/ui/pctlogin.aspx");

    assertEquals("Project Creation Tool", driver.getTitle());
    String name = (new Exception().getStackTrace()[0].getMethodName());
    CaptureScreenshot.takeScreenshot(driver, name);
    driver.switchTo().frame(0);
    driver.findElement(By.id("UserNameTextBox")).clear();
    driver.findElement(By.id("UserNameTextBox")).sendKeys("qa");
    driver.findElement(By.id("PasswordTextBox")).clear();
    driver.findElement(By.id("PasswordTextBox")).sendKeys("qa");
    driver.findElement(By.id("LoginButton")).click();
    driver.findElement(By.id("CreateProj")).click();
    driver.findElement(By.id("NameInput")).clear();
    driver.findElement(By.id("NameInput")).sendKeys("New Project 19 July");
    driver.findElement(By.id("DescriptionInput")).clear();
    driver.findElement(By.id("DescriptionInput")).sendKeys("Test Project");
    driver.findElement(By.xpath("(//button[@type='button'])[2]")).click();
    assertEquals("Project Creation Tool", driver.getTitle());
    assertEquals("Project Creation Tool", driver.getTitle());
    driver.findElement(By.id("LogOut_Link")).click();
    assertEquals("Project Creation Tool", driver.getTitle());
  }
コード例 #4
0
  @Ignore
  @Test
  public void TestCase_005() throws Exception {

    LogGenerator.addLog(Level.INFO, "Starting Test Case_004");
    driver.get("http://myitlabgrader.com/HTML5/SIMFrame.html");
    // assertEquals("SIMs Demo", driver.getTitle());
    synchronized (driver) {
      driver.wait(12000);
    }
    System.out.println("test1");

    WebElement we = driver.findElement(By.cssSelector("#msword > img"));

    Actions action = new Actions(driver);
    action.doubleClick(we);
    action.perform();

    synchronized (driver) {
      driver.wait(12000);
    }

    String name = (new Exception().getStackTrace()[0].getMethodName());
    CaptureScreenshot.takeScreenshot(driver, name);

    synchronized (driver) {
      driver.wait(6000);
    }

    driver.findElement(By.cssSelector("span.ribbon-title.IDFileTab")).click();

    driver
        .findElement(By.xpath("html/body/div/div/div[3]/div/div/div/div/div[3]/div/div/div[4]"))
        .click();

    driver
        .findElement(
            By.xpath("/html/body/div/div/div[3]/div/div/div/div/div[3]/div/div[4]/div[3]/p[5]/img"))
        .click();

    we =
        driver.findElementByXPath(
            "/html/body/div/div/div[6]/div/div[2]/div/div/div[3]/div/div[2]/div[8]/img");

    action.doubleClick(we);
    action.perform();
  }