org.openqa.selenium.remote.RemoteWebDriver.getWindowHandles()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(154)

本文整理了Java中org.openqa.selenium.remote.RemoteWebDriver.getWindowHandles方法的一些代码示例,展示了RemoteWebDriver.getWindowHandles的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RemoteWebDriver.getWindowHandles方法的具体详情如下:
包路径:org.openqa.selenium.remote.RemoteWebDriver
类名称:RemoteWebDriver
方法名:getWindowHandles

RemoteWebDriver.getWindowHandles介绍

暂无

代码示例

代码示例来源:origin: la-team/light-admin

@Override
public Set<String> getWindowHandles() {
  return webDriver.getWindowHandles();
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-test-ui

@Override
public Set<String> getWindowHandles()
{
  return this.wrappedDriver.getWindowHandles();
}

代码示例来源:origin: org.eclipse.che.selenium/che-selenium-core

@Override
public Set<String> getWindowHandles() {
 return driver.getWindowHandles();
}

代码示例来源:origin: com.applitools/eyes-selenium-java3

public Set<String> getWindowHandles() {
  return driver.getWindowHandles();
}

代码示例来源:origin: org.mycore/selenium-utils

public Set<String> getWindowHandles() {
  return delegate.getWindowHandles();
}

代码示例来源:origin: stackoverflow.com

public static void moveToAnotherTab(RemoteWebDriver driver) {
  for (String winHandle : driver.getWindowHandles()) {
    driver.switchTo().window(winHandle);
  }
}

代码示例来源:origin: com.github.becauseQA/becauseQA-utils

public WebDriver window(String windowHandleOrName) {
 try {
  execute(DriverCommand.SWITCH_TO_WINDOW, ImmutableMap.of("handle", windowHandleOrName));
  return RemoteWebDriver.this;
 } catch (NoSuchWindowException nsw) {
  // simulate search by name
  String original = getWindowHandle();
  for (String handle : getWindowHandles()) {
   switchTo().window(handle);
   if (windowHandleOrName.equals(executeScript("return window.name"))) {
    return RemoteWebDriver.this; // found by name
   }
  }
  switchTo().window(original);
  throw nsw;
 }
}

代码示例来源:origin: com.github.becausetesting/commons

/**
 * @Title: switchToWindowWithTitle @Description: TODO @author
 *         ahu@greendotcorp.com @param @param windowTitle @return void
 *         return type @throws
 */
public void switchToWindowWithTitle(String windowTitle) {
  // throw new PendingException();
  try {
    Robot robot = new Robot();
    Set<String> allwindows = driver.getWindowHandles();
    for (String window : allwindows) {
      driver.switchTo().window(window);
      if (driver.getTitle().contains(windowTitle)) {
        robot.delay(5000);
        // robot.keyPress(keycode);
      }
    }
  } catch (AWTException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
}

相关文章