public void run() {
    actions = new Actions(driver);

    driver.get("http://dancing9.interest.me/index.m");
    메인페이지를_로딩한다();

    Vote메뉴_Vote를_클릭한다();
    Vote메뉴_SoloStage를_클릭한다();

    About메뉴_WinnersPrize를_클릭한다();
    About메뉴_Audition을_클릭한다();
    About메뉴_MCIntroduction을_클릭한다();

    팀메뉴_블루아이vs레드윙스를_클릭한다();
    팀메뉴_마스터를_클릭한다();
    팀메뉴_멤버링크를_클릭한다();

    Video메뉴_Video를_클릭한다();
    Video메뉴_Clip를_클릭한다();
    Video메뉴_Preview를_클릭한다();

    게시판메뉴_NotiveViewersOpinion를_클릭한다();
    게시판메뉴_News를_클릭한다();

    More메뉴_DanceTerms를_클릭한다();
    More메뉴_Webtoon을_클릭한다();
    More메뉴_Sponsor를_클릭한다();
    driver.close();
  }
  public void textExtraction(Article a) {

    //        storePageExtractionCondition();
    System.out.println("starting driver : " + a.getLink());
    driver.get(a.getLink());

    System.out.println("driver started");

    Newspaper newspaper = a.getPaper();

    List<String> parts = new ArrayList<String>();
    parts.add("header");
    parts.add("date");
    parts.add("preface");
    parts.add("body");
    parts.add("upleft-component");
    parts.add("downright-component");

    for (String s : parts) {
      StringBuilder headerString = new StringBuilder();
      System.out.println("part : " + s);

      String descriptor = newspaper.getCondition(s);

      System.out.println("element to find : " + descriptor);

      List<WebElement> lista = null;
      lista = driver.findElements(By.tagName(descriptor));

      for (Iterator<WebElement> it1 = lista.iterator(); it1.hasNext(); ) {
        WebElement webElement = it1.next();

        headerString.append(webElement.getText());
      }

      //            headerText = findByDescriptor(descriptor, i, n);
      //            WebElement selectheaderText = findByDescriptor(descriptor, i, n);
      if (headerString.length() > 0) {

        System.out.println("str to print : " + headerString.toString());
        if (s.equalsIgnoreCase("header")) {
          a.setTitle(headerString.toString());
        } else if (s.equalsIgnoreCase("preface")) {
          a.setPreface(headerString.toString());
        } else if (s.equalsIgnoreCase("date")) {
          //                    a.setPreface(headerString.toString());
        } else if (s.equalsIgnoreCase("upleft-component")) {
          //                    a.setPreface(headerString.toString());
        } else if (s.equalsIgnoreCase("downright-component")) {
          //                    a.setPreface(headerString.toString());
        } else {
          a.setBody(headerString.toString());
        }
      }
    }
  }
  // DOES NOT WORK
  @Test
  public void descendant() {
    // System.setProperty("webdriver.ie.driver", "F:\\SELENIUM DRIVERS\\IEDriverServer.exe");
    // InternetExplorerDriver driver = new InternetExplorerDriver();

    System.setProperty("webdriver.chrome.driver", "F:\\SELENIUM DRIVERS\\chromedriver.exe");
    ChromeDriver driver = new ChromeDriver();

    driver.get("C:\\Users\\shree\\Desktop\\HTML\\WebTable.HTML");
    driver.manage().window().maximize();
    driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);

    WebElement td = driver.findElement(By.cssSelector("td[innerText='John']"));
    System.out.println(td.getText());
  }
  public void run() {

    Article a = null;
    while (downloads) {

      if (articleList.size() > 0) {
        if (driver == null) {
          //                    driver = new HtmlUnitDriver();
          driver = new ChromeDriver();
        }

        a = null;

        synchronized (articleList) {
          if (articleList.size() > 0) {
            a = articleList.remove(0);
          }
        }

        if (a != null) {

          textExtraction(a);
          ArticleHandler ah = ArticleHandler.createInstance();
          ah.notifyListeners(ArticleListener.TEXT_EXTRACTED, a);
        }
      }
    }

    driver.quit();

    stopped = true;
  }
  @Test(groups = {"sf", "qa", "functest"})
  public void test_a() throws InterruptedException, IOException {
    driver.get("https://mhe--qa.cs24.my.salesforce.com");

    // SF - login //
    SFAdminLoginPage sfAdminLoginPage = new SFAdminLoginPage(driver);
    Thread.sleep(2000);
    sfAdminLoginPage.enterSFUsername("*****@*****.**");
    sfAdminLoginPage.enterSFPassword("Abhijazz9");
    sfAdminLoginPage.clickSFSubmitLogin();
    Thread.sleep(5000);

    // Click Contacts Button
    SFAdminHomePage sfAdminHomePage = new SFAdminHomePage(driver);
    sfAdminHomePage.clickProductsviewerButton();
    Thread.sleep(5000);

    SFAdminProductViewerPage sfAdminProductViewerPage = new SFAdminProductViewerPage(driver);

    // Searching Products
    sfAdminProductViewerPage.enterSearchDetails("1429299843");
    sfAdminProductViewerPage.clickSearchButton();
    Thread.sleep(9000);
    sfAdminProductViewerPage.clickProductExpander();
    Thread.sleep(5000);
    assertTrue(sfAdminProductViewerPage.verifyISBN().isDisplayed());
    // assertTrue(sfAdminSamplingWizardPage.verifyEAN().isdisplayed());
    assertTrue(sfAdminProductViewerPage.verifyLongtitle().isDisplayed());
    // assertTrue(sfAdminSamplingWizardPage.verifyShorttitle().isdisplayed());

  }
 private void More메뉴_Webtoon을_클릭한다() {
   More메뉴에_마우스를_가져다놓는다();
   moveAndClick(By.xpath("//*[@id=\"navi\"]/div/ul/li[6]/div/ul/li[2]/a"));
   new WebDriverWait(driver, 10).until(ExpectedConditions.alertIsPresent());
   // alert을 닫는다.
   try {
     Thread.sleep(5 * 1000);
   } catch (InterruptedException e) {
   }
   Alert alert = driver.switchTo().alert();
   alert.accept();
 }
  @AfterMethod
  public void catchExceptions(ITestResult result) {
    System.out.println("result" + result);
    String methodName = result.getName();
    System.out.println(methodName);

    if (!result.isSuccess()) {

      try {

        File scrFile = driver.getScreenshotAs(OutputType.FILE);
        FileUtils.copyFile(
            scrFile,
            new File("C:\\MacmillanProjects\\target\\TestArtefacts\\Test_failing-shot.jpg"));
      } catch (IOException e1) {
        e1.printStackTrace();
      }
    }
  }
 public static void quit() {
   driver.quit();
 }
 public static void DieModalDie() {
   Alert alert = driver.switchTo().alert();
   alert.accept();
 }
 public static void get(String url) {
   driver.get(url);
 }
예제 #11
0
  public static void main(String[] args) {
    // TODO Auto-generated method stu2) Close all the frames other than center -

    System.setProperty(
        "webdriver.chrome.driver",
        "C:\\Users\\Admin\\MyWorkspace\\SeleniumWebDriver\\chromedriver_win32\\chromedriver.exe");
    ChromeDriver driver = new ChromeDriver();
    driver.get("http://www.crystalcruises.com");
    String parentWindowHandle = driver.getWindowHandle();
    driver.findElementByLinkText("GUEST CHECK-IN").click();
    Set<String> allWindowHandles = driver.getWindowHandles();
    for (String windowHandle : allWindowHandles) {
      driver.switchTo().window(windowHandle);
    }
    driver.findElementByLinkText("click here").click();

    Set<String> allWndHandles = driver.getWindowHandles();
    for (String wndHandle : allWndHandles) {
      driver.switchTo().window(wndHandle);
    }
    Select dropdown = new Select(driver.findElementByClassName("goog-te-combo"));
    dropdown.selectByValue("ta");

    // Run configuration ->Common tab -> Other radio button -> UTF 8 -> Click Apply -> Click Run
    String text = driver.findElementByXPath("//*[@id='mainBody']/div[1]/div[2]").getText();
    System.out.println(text);

    // not getting tamil text?
  }
 private void assertElement(By partialLinkText) {
   WebElement el = driver.findElement(partialLinkText);
   if (el == null) {
     throw new RuntimeException("not found");
   }
 }
 private void moveAndClick(By by) {
   WebElement el = driver.findElement(by);
   actions.moveToElement(el);
   actions.click();
   actions.perform();
 }
 private void moveToElement(By by) {
   actions.moveToElement(driver.findElement(by));
 }