コード例 #1
0
  public static void testBrowser(WebDriver driver1) {
    try {
      basicBrowserTester(driver1); // // just test some basic adding and browsing	
      System.out.println("\nDone for basicBrowserTester.");

      shareButtonTest(driver1);
      System.out.println("\nDone for shareButtonTest without user login.");

      addWishListTest(driver1); // / try add to wishlist without user login
      System.out.println("\nDone for addWishListTest without user login.");

      addFittingRoomTest(driver1); // / try add to Fitting Room without user login
      System.out.println("\nDone for addFittingRoomTest without user login.");

      addItemTest(driver1);
      System.out.println("\nDone for addItemTest without user login.");

      logInUser(driver1);
      System.out.println("\nDone log in.");
      sleep();

      basicBrowserTester(driver1); // // just test some basic adding and browsing	
      System.out.println("\nDone for basicBrowserTester with user login.");

      shareButtonTest(driver1);
      System.out.println("\nDone for shareButtonTest with user login.");

      addWishListTest(driver1); // // try again with user lgoin
      System.out.println("\nDone for addWishListTest with user login.");

      addFittingRoomTest(driver1); // // try again with user lgoin
      System.out.println("\nDone for addFittingRoomTest with user login.");

      removeProductsFromWishList(driver1, 3); // / remove products from wish list
      System.out.println("\nDone for removeProductsFromWishList.");

      addItemTest(driver1);
      System.out.println("\nDone for addItemTest with user login.");

      // addComment(driver1, 0,0);

      logOutUser(driver1);

      driver1.close();
      if (success) {
        System.out.println("\ntest successfully");
      }
    } catch (Exception e) {
      System.out.println("\nException appearred, element not found.\n ");
      driver1.close();
      System.exit(0);
    }
  }
コード例 #2
0
 // Its time to close the finish the test case
 @AfterMethod
 public void afterMethod() {
   // Printing beautiful logs to end the test case
   Log.endTestCase(sTestCaseName);
   // Closing the opened driver
   driver.close();
 }
コード例 #3
0
 public static void main(String[] args) {
   System.setProperty("webdriver.chrome.driver", "C:/WebServerSelenium/chromedriver.exe");
   WebDriver driver = new ChromeDriver();
   driver.navigate().to(Configurations.HOMEPAGE);
   driver.manage().window().maximize();
   try {
     driver
         .findElement(By.xpath("html/body/form/table/tbody/tr/td/div/center[1]/input[1]"))
         .sendKeys("*****@*****.**");
     driver
         .findElement(By.xpath("html/body/form/table/tbody/tr/td/div/center[1]/input[2]"))
         .sendKeys("Asdfghjkl123");
     driver
         .findElement(By.xpath("html/body/form/table/tbody/tr/td/div/center[2]/input[1]"))
         .click();
     driver.findElement(By.xpath("html/body/div/div/table/tbody/tr[2]/td[1]/a")).click();
     driver.findElement(By.xpath("html/body/form/table/tbody/tr/td[1]/input[2]")).click();
     List<WebElement> list =
         driver.findElements(
             By.xpath(
                 "//*[contains(text(),'"
                     + "Nessun paziente selezionato o nessun indirizzo email inserito."
                     + "')]"));
     Assert.assertTrue(
         list.size() > 0, "Nessun paziente selezionato o nessun indirizzo email inserito.");
     System.out.println("Test Passed");
   } catch (AssertionError e) {
     System.out.println("Test Failed");
     System.out.println(e.getMessage());
   }
   driver.close();
 }
コード例 #4
0
 @AfterTest
 public void teardown() {
   if (driver != null) {
     driver.close();
     driver = null; // to be gc'd
   }
 }
コード例 #5
0
  /**
   * 取得新闻标题、时间和评论数的集合
   *
   * @param urls 所有新闻URL集合
   * @return 新闻标题、时间和评论数的集合
   */
  public static List<String> getTimeAndJoin(List<String> urls) {
    List<String> listTimeAndJoin = new ArrayList<String>();

    int num = 1;
    // System.setProperty("webdriver.ie.driver", "." + File.separator + "Driver" + File.separator +
    // "IEDriverServer.exe");
    // WebDriver driver = new InternetExplorerDriver();
    WebDriver driver = new FirefoxDriver();
    for (int i = 0; i < urls.size(); i++) {
      // System.setProperty("webdriver.ie.driver", "." + File.separator + "Driver" + File.separator
      // + "IEDriverServer.exe");
      // WebDriver driver = new InternetExplorerDriver();
      driver.get(urls.get(i));
      List<WebElement> headline =
          driver.findElements(By.cssSelector("div[class='atitle tCenter']"));
      List<WebElement> timeAndJoin = driver.findElements(By.cssSelector("div[class='about']"));

      StringBuffer sb = null;
      sb = new StringBuffer();

      if ((timeAndJoin.size() == 1) && (headline.size() == 1)) {
        sb.append("[新闻 " + num + "]");
        sb.append(headline.get(0).getText() + "\t");
        String[] temp = timeAndJoin.get(0).getText().split("\n");
        sb.append(temp[0] + "\t" + temp[1] + "\t" + temp[2]);
        // sb.append(timeAndJoin.get(0).getText().replaceAll("\\s+", ""));
        listTimeAndJoin.add(sb.toString());
        num++;
      }
      // driver.close();
    }
    driver.close();
    return listTimeAndJoin;
  }
コード例 #6
0
 public static void main(String[] args) {
   System.setProperty("webdriver.chrome.driver", "C:/WebServerSelenium/chromedriver.exe");
   WebDriver driver = new ChromeDriver();
   driver.navigate().to(Configurations.HOMEPAGE);
   driver.manage().window().maximize();
   try {
     driver
         .findElement(By.xpath("html/body/form/table/tbody/tr/td/div/center[1]/input[1]"))
         .sendKeys("*****@*****.**");
     driver
         .findElement(By.xpath("html/body/form/table/tbody/tr/td/div/center[1]/input[2]"))
         .sendKeys("Asdfghjkl123");
     driver
         .findElement(By.xpath("html/body/form/table/tbody/tr/td/div/center[2]/input[1]"))
         .click();
     driver.findElement(By.xpath("html/body/div/div/table/tbody/tr[2]/td[1]/a")).click();
     driver.findElement(By.xpath(".//*[@id='textNomeMedico']")).sendKeys("Vincenzo");
     driver.findElement(By.xpath(".//*[@id='textCognomeMedico']")).sendKeys("Nunziata");
     driver.findElement(By.xpath("html/body/table/tbody/tr/td[1]/form/input[3]")).sendKeys("");
     driver.findElement(By.xpath("html/body/table/tbody/tr/td[1]/form/input[5]")).click();
     driver.findElement(By.xpath(".//*[@id='selectRisultati']/option")).click();
     driver.findElement(By.xpath(".//*[@id='confirmButton']/input")).click();
     List<WebElement> list =
         driver.findElements(
             By.xpath("//*[contains(text(),'" + "Richiesta inviata con successo" + "')]"));
     Assert.assertTrue(list.size() > 0, "Richiesta inviata con successo");
     System.out.println("Test Passed");
   } catch (AssertionError e) {
     System.out.println("Test Failed");
     System.out.println(e.getMessage());
   }
   driver.close();
 }
コード例 #7
0
  public void testAwsppWebDriver(int docs, int times) throws InterruptedException {
    init();
    WebDriver driver = new FirefoxDriver();
    //		WebDriver driver = new HtmlUnitDriver();
    for (int j = 0; j < times; j++) {
      driver.get(baseUrl);
      driver.manage().timeouts().implicitlyWait(waitTimeout, TimeUnit.SECONDS);
      // create/resume transaction

      WebElement docs_input = driver.findElement(By.id("create_docs_1"));
      driver.manage().timeouts().implicitlyWait(waitTimeout, TimeUnit.SECONDS);
      docs_input.clear();
      docs_input.sendKeys("" + docs);

      WebElement createButton = driver.findElement(By.id("resume"));
      driver.manage().timeouts().implicitlyWait(waitTimeout, TimeUnit.SECONDS);
      createButton.click();
      for (int i = 0; i < docs; i++) {

        WebElement img = driver.findElement(By.xpath("//img[@alt='Click to sign']"));
        driver.manage().timeouts().implicitlyWait(waitTimeout, TimeUnit.SECONDS);
        img.click();

        WebElement submitButton = driver.findElement(By.name("button"));
        driver.manage().timeouts().implicitlyWait(waitTimeout, TimeUnit.SECONDS);

        submitButton.click();
      }
      WebElement link = driver.findElement(By.linkText("Go Back to Parent Page"));
      driver.manage().timeouts().implicitlyWait(waitTimeout, TimeUnit.SECONDS);
      link.click();
    }
    driver.close();
  }
コード例 #8
0
ファイル: BasePage.java プロジェクト: prakumar/CMP-Automation
 public void closeBrowser() {
   driver.manage().deleteAllCookies();
   driver.close();
   if (driver != null) {
     driver.quit();
   }
 }
コード例 #9
0
 @Test
 public void startWebDriver() {
   WebDriver driver = new FirefoxDriver();
   driver.navigate().to("http://seleniumsimplified.com");
   Assert.assertTrue(
       "Title should start differently", driver.getTitle().startsWith("Selenium Simplified"));
   driver.close();
 }
 @AfterClass
 public void afterClass() throws Exception {
   // Printing logs to end the test case
   Log.endTestCase(sTestCaseName);
   // Closing the opened driver
   driver.close();
   // Closing the opened excel file
   ExcelUtils.closeExcelFile();
 }
コード例 #11
0
  public static void testWebDriver() throws InterruptedException {

    WebDriver driver = new FirefoxDriver();
    driver.manage().window().maximize();
    driver.navigate().to("https://app.marinsoftware.com");

    log.info(driver.getTitle());
    driver.close();
  }
コード例 #12
0
 public void cleanUp(WebDriver webDriver) {
   Iterator<String> handles = webDriver.getWindowHandles().iterator();
   while (handles.hasNext()) {
     String handle = handles.next();
     WebDriver local = switchToWindow(handle);
     if (local != null) {
       local.close();
     }
   }
 }
コード例 #13
0
ファイル: WhenSearching.java プロジェクト: BI/tf-ads-bpa
 /** Pause before checking if driver completed. */
 @After
 public void Ending() {
   try {
     Thread.sleep(1000);
     driver.close();
     Thread.sleep(3000);
   } catch (Exception b) {
     b.getMessage();
   }
 }
コード例 #14
0
  public void end() {

    driver.close();
    try {
      Thread.sleep(3000);
    } catch (InterruptedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
コード例 #15
0
 public void closeWindow(String windowHandle, String... waitFor) {
   WebDriver local = switchToWindow(windowHandle);
   logger.info("Switching to window : " + driver.getTitle());
   if (waitFor != null && waitFor.length > 0) {
     setDriverWait(driver, waitFor[0]);
   }
   if (local != null) {
     local.close();
   }
 }
コード例 #16
0
ファイル: WDDemo1.java プロジェクト: tasabry12/SeleniumWD
  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();
  }
コード例 #17
0
  @After
  public void ShutDown(Scenario scenario) {
    if (scenario.isFailed()) {
      final byte[] screenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES);
      scenario.embed(screenshot, "image/png");
    }

    System.out.println("Before Closing the driver in the test Set Up = " + driver);
    driver.close();
    System.out.println("CLosed driver");
    System.out.println("After Closing the getdriver in the test Set Up = " + driver);
  }
コード例 #18
0
  @Test(groups = "wso2.greg", description = "verify adding new repositories are successful")
  public void testLogin() throws Exception {

    LoginPage test = new LoginPage(driver);
    test.loginAs(userInfo.getUserName(), userInfo.getPassword());
    RepositoryPage addRepositoryPage = new RepositoryPage(driver);
    String repositoryUrl = "http://dist.wso2.org/p2/carbon/releases/3.0.0";
    String repositoryName = "TestingRepo";
    addRepositoryPage.addRepository(repositoryUrl, repositoryName);
    addRepositoryPage.checkOnUploadRepository(repositoryName);
    driver.close();
  }
コード例 #19
0
  public void verifyResult() {
    String current_URL = driver.getCurrentUrl();
    int order_id;
    if (current_URL.contains("http://localhost:3000/order/display/")) {
      String parts[] = current_URL.split("/display/");
      order_id = Integer.parseInt(parts[1]);
      System.out.print(
          "<TaaS Response Start>{\"order_id\":" + order_id + "}<TaaS Response Complete>");

      driver.close();
    }
  }
  @Test
  public void should_check_and_close_javascript_alerts() {
    WebDriver driver = new FirefoxDriver();
    StaticSitePage page = new StaticSitePage(driver, 1000);
    page.open();

    page.openAlert();
    page.getAlert().accept();

    assertThat(page.getTitle(), is("Thucydides Test Site"));
    driver.close();
  }
コード例 #21
0
ファイル: MainClass.java プロジェクト: laiqb/bfm
 public void gid() {
   try {
     CreateTestngXml.gridHubLaunching();
     Thread.sleep(10000);
   } catch (InterruptedException e) {
     e.printStackTrace();
   } catch (IOException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   CreateTestngXml.grid("firefox", "chrome");
   driver.close();
 }
  @Test
  public void should_inject_jquery_into_the_page() {
    WebDriver driver = new FirefoxDriver();
    StaticSitePage page = new StaticSitePage(driver, 1000);
    page.open();

    page.evaluateJavascript("$('#firstname').focus();");

    Boolean jqueryInjected =
        (Boolean) page.evaluateJavascript("return (typeof jQuery === 'function')");
    assertThat(jqueryInjected, is(true));

    driver.close();
  }
コード例 #23
0
 @AfterMethod
 public void afterMethod(Method method) {
   String testName = method.getName();
   System.out.println("After Method for test " + testName);
   asapDriver.setReferenceData();
   Reporter.closeTestLevelReport(testName);
   String cmd =
       "\"C:\\Program Files (x86)\\Android\\android-sdk\\platform-tools\\adb.exe\" shell pm clear "
           + appPackage;
   System.out.println("Executing command :" + cmd);
   Generic.executeCommand(cmd);
   if (driver != null) {
     driver.close();
     driver = null;
   }
 }
コード例 #24
0
  @Test(dataProvider = "loginData")
  public void loginWordpress(String usrName, String passwd) {

    driver.manage().window().maximize();
    driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
    driver.get("https://wordpress.com/");
    driver.findElement(By.className("click-wpcom-login")).click();
    driver.findElement(By.id("user_login")).clear();
    driver.findElement(By.id("user_login")).sendKeys(usrName);
    driver.findElement(By.id("user_pass")).clear();
    driver.findElement(By.id("user_pass")).sendKeys(passwd);
    WebDriverWait wait = new WebDriverWait(driver, 60);
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("lkj")));

    driver.findElement(By.id("wp-submit")).click();
    driver.close();
    Assert.assertEquals("TRUE", "TRUE");
  }
コード例 #25
0
ファイル: AccountTest.java プロジェクト: niuhw/keycloak
  @Test
  public void sessions() {
    loginPage.open();
    loginPage.clickRegister();

    registerPage.register(
        "view", "sessions", "view-sessions@localhost", "view-sessions", "password", "password");

    Event registerEvent =
        events.expectRegister("view-sessions", "view-sessions@localhost").assertEvent();
    String userId = registerEvent.getUserId();

    events.expectLogin().user(userId).detail(Details.USERNAME, "view-sessions").assertEvent();

    sessionsPage.open();

    Assert.assertTrue(sessionsPage.isCurrent());

    List<List<String>> sessions = sessionsPage.getSessions();
    Assert.assertEquals(1, sessions.size());
    Assert.assertEquals("127.0.0.1", sessions.get(0).get(0));

    // Create second session
    WebDriver driver2 = WebRule.createWebDriver();
    try {
      OAuthClient oauth2 = new OAuthClient(driver2);
      oauth2.state("mystate");
      oauth2.doLogin("view-sessions", "password");

      Event login2Event =
          events.expectLogin().user(userId).detail(Details.USERNAME, "view-sessions").assertEvent();

      sessionsPage.open();
      sessions = sessionsPage.getSessions();
      Assert.assertEquals(2, sessions.size());

      sessionsPage.logoutAll();

      events.expectLogout(registerEvent.getSessionId());
      events.expectLogout(login2Event.getSessionId());
    } finally {
      driver2.close();
    }
  }
コード例 #26
0
  @Test
  public void candidateManualCheck() throws IOException, InterruptedException {
    initialize();
    openBrowser();
    driver.get(CONFIG.getProperty("testSiteName"));
    login_Valid();
    System.out.println("logged in Recruiters Portal");
    driver1 = new FirefoxDriver();
    driver1.get("https://staging.tempbuddy.com");
    // login_Candidate();
    driver1.findElement(By.id("username")).sendKeys("temp-buddy");
    driver1.findElement(By.id("password")).sendKeys("qwerty1");
    driver1.findElement(By.id("_submit")).click();
    System.out.println("in worker portal");
    Thread.sleep(3000);
    driver1.findElement(By.xpath("//*[@id='checkin-button']/div/span")).click();
    Thread.sleep(10000);
    driver1.findElement(By.xpath("//*[@id='checkin-button']/div/span")).click();
    Thread.sleep(5000);
    driver1.close();
    System.out.println("closed driver1");
    getObject("clientsLinkx").click();
    // getObject("addNewClientX").click();
    // Thread.sleep(5000);
    driver.quit();
    System.out.println("closed driver");

    /*Set<String> windows = driver.getWindowHandles();
    String recruiterHandle = driver.getWindowHandle();

    //opening another window using javascript
    ((JavascriptExecutor)driver).executeScript("window.open();");
    Set<String> window2 = driver.getWindowHandles();
    window2.removeAll(windows);
    String workerHandle = (String) window2.toArray()[0];
    driver.switchTo().window(workerHandle);
    driver.get("https://staging.tempbuddy.com");
    login_Candidate();
    System.out.println("in worker portal");
    driver.switchTo().window(recruiterHandle);
    System.out.println("back on recruiter portal");*/

  }
コード例 #27
0
  public static long runTest(int port)
      throws MalformedURLException, IOException, InterruptedException {
    long totalTime;

    // Start the clock
    Date start = new Date();

    // Ask for a JavaScript-enabled browser
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setJavascriptEnabled(true);

    WebDriver driver = new RemoteWebDriver(new URL("http://localhost:" + port), capabilities);
    Capabilities actualCapabilities = ((RemoteWebDriver) driver).getCapabilities();

    // And now use this to visit Google
    System.out.println("Loading 'http://www.google.com'...");
    driver.get("http://www.google.com");
    System.out.println("Loaded. Current URL is: '" + driver.getCurrentUrl() + "'");

    // Find the text input element by its name
    System.out.println("Finding an Element via [name='q']...");
    WebElement element = driver.findElement(By.name("q"));
    System.out.println("Found.");

    // Enter something to search for
    System.out.println("Sending keys 'Cheese!...'");
    element.sendKeys("Cheese!");
    System.out.println("Sent.");

    // Now submit the form. WebDriver will find the form for us from the element
    System.out.println("Submitting Element...");
    element.submit();
    System.out.println("Submitted.");

    // Check the title of the page
    System.out.println("Page title is: " + driver.getTitle());
    driver.close();

    totalTime = new Date().getTime() - start.getTime();
    System.out.println("Time elapsed (ms): " + totalTime);

    return totalTime;
  }
コード例 #28
0
ファイル: Helper.java プロジェクト: sailfishqa/june2five
  // ISDABENCHMARKsingleReportTest
  public static void ISDABENCHMARKsingleReportTest() throws InterruptedException, AWTException {

    WebDriver driver = StaticClass.driver;

    loginapp(driver);

    driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
    driver.findElement(By.tagName("body")).sendKeys("keys.down");
    driver.findElement(By.tagName("html")).sendKeys(Keys.chord(Keys.CONTROL, Keys.SUBTRACT));
    driver.findElement(By.tagName("html")).sendKeys(Keys.chord(Keys.CONTROL, Keys.SUBTRACT));
    driver.findElement(By.tagName("html")).sendKeys(Keys.chord(Keys.CONTROL, Keys.SUBTRACT));
    driver.findElement(By.xpath(".//*[@id='sidebar']/ul/li[3]/a/span")).click();
    driver.findElement(By.xpath(".//*[@id='sidebar']/ul/li[3]/ul/li[1]/a")).click();
    driver.findElement(By.xpath(".//*[@id='sidebar']/ul/li[3]/ul/li[1]/ul/li[2]/a")).click();
    Thread.sleep(5000);
    new Select(driver.findElement(By.xpath(".//*[@id='ContentPlaceHolder1_ddlClient']")))
        .selectByVisibleText("Delta Advisors LLC");
    Thread.sleep(3000);
    new Select(driver.findElement(By.xpath(".//*[@id='ContentPlaceHolder1_ddlClientEntityList']")))
        .selectByVisibleText("Delta Distressed Arbitrage Fund");
    Thread.sleep(3000);

    String parentwindow = driver.getWindowHandle(); // For Parent window
    driver.findElement(By.xpath(".//*[@id='ContentPlaceHolder1_btnPreview']")).click();
    Thread.sleep(10000);

    for (String Child_Window : driver.getWindowHandles()) {
      driver.switchTo().window(Child_Window);
    }
    Thread.sleep(2000);
    driver.findElement(By.linkText("Generate PDF")).click(); // Switch to Child window
    Thread.sleep(3000);
    driver.findElement(By.xpath(".//*[@id='btnGeneratePDF']")).click();
    Thread.sleep(5000);
    Robot rb = new Robot();
    rb.keyPress(KeyEvent.VK_ENTER);
    Thread.sleep(2000);
    driver.close(); // Close Child window
    driver.switchTo().window(parentwindow); // Finally Switch to
    Thread.sleep(2000);
  }
コード例 #29
0
  public static void main(String[] args) {

    System.out.println("Testing the CPMS Dashboard Login " + CpmsDashboard.getPageTitle());

    String[] scheme = new String[3];
    scheme[0] = "MOT2";
    scheme[1] = "OLCS";
    scheme[2] = "MC2";

    WebDriver driver = new FirefoxDriver();
    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
    driver.get("http://payment-app.psdv-ap01.ps.npm/");

    CpmsDashboard cpmsDashboard = new CpmsDashboard(driver);
    cpmsDashboard.loginAndLogout("test_customer", scheme);

    driver.get("http://payment-app.psdv-ap01.ps.npm/");
    cpmsDashboard.loginAndLogout(scheme[0], "AE5555");
    driver.close();
    driver.quit();
  }
コード例 #30
0
ファイル: searchTest.java プロジェクト: chinwahc/damselenium
  @Test
  public void SearchForJPEG() throws InterruptedException {

    /*firefox keeps failing, investigate why, test is fine in chrome
     * Could be solved by using the wait command(fluent wait would be better), investigate further,
     * sendkeys command seems to be executing before the element is loaded on page only in firefox.
     * Once test is working on all browsers, extend the SimpleSearchAction method to accept arguments for the simple search text box.(done)
     */
    WebDriver driver = BrowserFactory.getBrowser("Chrome");
    driver.get(Pages.LoginPage);
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

    Login_Action.ExecuteAsAdmin(driver);
    driver.navigate().to(Pages.DocLib);

    SimpleSearchAction.ExecuteSearch(driver, "shutterstock");

    VerifySearchResult.checkSearchResults(driver, "112");

    Logout_Action.Execute(driver);
    driver.close();
  }