示例#1
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 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();
 }
 public static void DieModalDie() {
   Alert alert = driver.switchTo().alert();
   alert.accept();
 }