Java 类org.openqa.selenium.UnsupportedCommandException 实例源码

项目:marathonv5    文件:JavaDriverTest.java   
public void elementClearOnNonClearableComponents() throws Throwable {
    driver = new JavaDriver();
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });
    WebElement element1 = driver.findElement(By.name("click-me"));
    try {
        element1.clear();
        throw new MissingException(UnsupportedCommandException.class);
    } catch (UnsupportedCommandException e) {

    }
}
项目:marathonv5    文件:JavaDriverTest.java   
public void isSelectedOnNonSelectableComponents() throws Throwable {
    driver = new JavaDriver();
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });
    WebElement element1 = driver.findElement(By.name("text-field"));
    try {
        element1.isSelected();
        throw new MissingException(UnsupportedCommandException.class);
    } catch (UnsupportedCommandException e) {

    }
}
项目:devtools-driver    文件:SetTimeoutHandler.java   
/**
 * type - {string} The type of operation to set the timeout for. Valid values are: "script" for
 * script timeouts, "implicit" for modifying the implicit wait timeout and "page load" for setting
 * a page load timeout.
 */
@Override
public Response handle() throws Exception {
  JsonObject payload = getRequest().getPayload();
  String type = payload.getString("type", "");
  final WebDriverLikeCommand command;
  if ("page load".equals(type)) {
    command = WebDriverLikeCommand.URL;
  } else if ("script".equals(type)) {
    command = WebDriverLikeCommand.EXECUTE_SCRIPT;
  } else {
    throw new UnsupportedCommandException("set timeout for " + payload);
  }

  long timeout = payload.getJsonNumber("ms").longValue();
  getSession().configure(command).set(type, timeout);

  Response res = new Response();
  res.setSessionId(getSession().getSessionId());
  res.setStatus(0);
  res.setValue(new JSONObject());
  return res;
}
项目:jwebrobot    文件:Reporter.java   
void processLogEntries(ScenarioExecutionContext context, ActionReport actionReport) {
    try {
        List<org.openqa.selenium.logging.LogEntry> logEntries = context.getDriver().manage().logs().get(LogType.BROWSER).getAll();
        ExecutorOptions options = context.getGlobalContext().getOptions();

        // TODO extract mapper
        List<LogEntry> convertedLogEntries = new ArrayList<>();

        for (org.openqa.selenium.logging.LogEntry logEntry : logEntries) {
            LogLevel actualLevel = convertLogLevel(logEntry.getLevel());

            if (LogEntry.isIncluded(options.getBrowserLogLevel(), actualLevel)) {
                convertedLogEntries.add(new LogEntry(
                    actualLevel, new Date(logEntry.getTimestamp()), logEntry.getMessage()));
            }
        }

        actionReport.setLogEntries(convertedLogEntries);
    } catch (UnsupportedCommandException e) {
        // TODO set flag on the report: https://github.com/automate-website/waml-io/issues/2
        LOG.warn("Current WebDriver does not support browser logging!");
    }
}
项目:seleniumtestsframework    文件:RemoteDriverFactory.java   
protected void setPageLoadTimeout(final long timeout, final BrowserType type) {
    switch (type) {

        case Chrome :
            try {
                driver.manage().timeouts().pageLoadTimeout(timeout, TimeUnit.SECONDS);
            } catch (UnsupportedCommandException e) {
                e.printStackTrace();
            }

            break;

        case FireFox :
        case InternetExplore :
            driver.manage().timeouts().pageLoadTimeout(timeout, TimeUnit.SECONDS);
            break;

        default :
    }
}
项目:Selenium-Foundation    文件:Frame.java   
/**
 * Switch driver focus to the parent of the specified frame context element.
 * <p>
 * <b>NOTE</b> This method initially invokes {@code driver.switchTo().parentFrame()}. If that fails with
 * {@link UnsupportedCommandException}, it invokes {@code element.switchTo()} as a fallback.
 * 
 * @param element frame context element
 * @return parent search context
 */
public static SearchContext switchToParentFrame(RobustWebElement element) {
    if (canSwitchToParentFrame) {
        try {
            return element.getWrappedDriver().switchTo().parentFrame();
        } catch (WebDriverException e) {
            if (Throwables.getRootCause(e) instanceof UnsupportedCommandException) {
                canSwitchToParentFrame = false;
            } else {
                throw e;
            }
        }
    }
    return element.switchTo();
}
项目:marathonv5    文件:JListXTest.java   
public void unsupportedPseudoElement() throws Throwable {
    driver = new JavaDriver();
    try {
        driver.findElement(By.cssSelector("#list-1::xth-item(21)"));
        throw new MissingException(UnsupportedCommandException.class);
    } catch (UnsupportedCommandException e) {

    }
}
项目:devtools-driver    文件:SetFrameHandler.java   
@Override
public Response handle() throws Exception {
  JsonValue p = getRequest().getPayload().get("id");

  if (JsonValue.NULL.equals(p)) {
    getWebDriver().getContext().setCurrentFrame(null, null, null);
  } else {
    RemoteWebElement iframe;
    switch (p.getValueType()) {
      case NUMBER:
        iframe = getIframe(((JsonNumber) p).intValue());
        break;
      case OBJECT:
        String id = ((JsonObject) p).getString("ELEMENT");
        iframe = getWebDriver().createElement(id);
        break;
      case STRING:
        iframe = getIframe(((JsonString) p).getString());
        break;
      default:
        throw new UnsupportedCommandException("cannot select frame by " + p.getClass());
    }
    RemoteWebElement document = iframe.getContentDocument();
    RemoteWebElement window = iframe.getContentWindow();
    getWebDriver().getContext().setCurrentFrame(iframe, document, window);
  }

  Response res = new Response();
  res.setSessionId(getSession().getSessionId());
  res.setStatus(0);
  res.setValue(new JSONObject());
  return res;
}
项目:mycore    文件:SideBarIT.java   
@Test
/**
 * Ignored because https://github.com/mozilla/geckodriver/issues/233
 */
public void testSideBarResize() throws Exception {
    this.setTestName(getClassname() + "-testSideBarResize");
    this.getDriver();
    this.getAppController().openViewer(this.getDriver(), getTestDerivate());

    ImageViewerController controller = this.getViewerController();

    ToolBarController tbController = controller.getToolBarController();
    SideBarController sbController = controller.getSideBarController();

    tbController.pressButton(ToolBarController.BUTTON_ID_SIDEBAR_CONTROLL);
    tbController.clickElementById(ImageOverviewController.IMAGE_OVERVIEW_SELECTOR);

    int sbWidthStart = sbController.getSideBarWidth();

    try { // Firefox does not support actions so we just let the test pass.
        sbController.dragAndDropByXpath("//div[contains(@class,\"sidebar\")]/span[@class=\"resizer\"]", 50, 0);
    } catch (UnsupportedCommandException e) {
        LOGGER.warn("Driver does not support Actions", e);
        return;
    }
    int sbWidthEnd = sbController.getSideBarWidth();

    assertLess(sbWidthEnd, sbWidthStart, "Sidebar width schould be increased!");

}
项目:mycore    文件:SideBarIT.java   
@Test
public void testOverviewLayout() throws InterruptedException {
    this.setTestName(getClassname() + "-testOvervieLayout");
    this.getDriver();
    this.getAppController().openViewer(this.getDriver(), getTestDerivate());

    ImageViewerController controller = this.getViewerController();

    ToolBarController tbController = controller.getToolBarController();
    SideBarController sbController = controller.getSideBarController();

    tbController.pressButton(ToolBarController.BUTTON_ID_SIDEBAR_CONTROLL);
    tbController.clickElementById(ImageOverviewController.IMAGE_OVERVIEW_SELECTOR);

    int before = sbController.countThumbnails();

    try {
        sbController.dragAndDropByXpath("//div[contains(@class,'sidebar')]/span[@class='resizer']", 300, 0);
    } catch (UnsupportedCommandException e) {
        LOGGER.warn("Driver does not support Actions", e);
        return;
    }

    Thread.sleep(1000);
    int after = sbController.countThumbnails();

    Assert.assertEquals(2 * before, after);
}
项目:seleniumtestsframework    文件:SauceLabsDriverFactory.java   
protected void setPageLoadTimeout(final long timeout) {
    try {
        driver.manage().timeouts().pageLoadTimeout(timeout, TimeUnit.SECONDS);
    } catch (UnsupportedCommandException e) {
        // chromedriver does not support pageLoadTimeout
    }
}
项目:web-test-framework    文件:Driver.java   
private synchronized void terminate() {
  Assert.assertTrue(inUse == false);
  if (driver != null) {
    try {
      driver.quit();
      if (factory != null) {
        factory.reportThatDriverQuitSuccessfully(this);
      }
      driver = null; // set the driver null so we don't try to use it anymore.
    } catch (UnsupportedCommandException ex) {
      LOG.error(ex.toString());
    }
  }

}
项目:seletest    文件:AppiumDriverController.java   
@Override
@Monitor
@RetryFailure(retryCount=3)
public AppiumDriverController setNetworkConnection(boolean airplaneMode, boolean wifi, boolean data) {
    if(webDriver() instanceof AndroidDriver) {
        NetworkConnectionSetting network=new NetworkConnectionSetting(false, true, true);
        network.setAirplaneMode(airplaneMode);
        network.setData(data);
        network.setWifi(wifi);
        ((AndroidDriver)webDriver()).setNetworkConnection(network);
    } else {
        throw new UnsupportedCommandException("The command setNetworkConnection is not used with IOSDriver");
    }
    return this;
}
项目:SilkAppDriver    文件:ExceptionTests.java   
@Test(expected = UnsupportedCommandException.class)
public void testGoNotSupported() {
    driver.navigate().to("http://www.google.at");
}
项目:SilkAppDriver    文件:ExceptionTests.java   
@Test(expected = UnsupportedCommandException.class)
public void testGetCurrentUrlNotSupported() {
    driver.getCurrentUrl();
}
项目:SilkAppDriver    文件:ExceptionTests.java   
@Test(expected = UnsupportedCommandException.class)
public void testBackNotSupported() {
    driver.navigate().back();
}
项目:SilkAppDriver    文件:ExceptionTests.java   
@Test(expected = UnsupportedCommandException.class)
public void testForwardNotSupported() {
    driver.navigate().forward();
}
项目:SilkAppDriver    文件:ExceptionTests.java   
@Test(expected = UnsupportedCommandException.class)
public void testRefreshNotSupported() {
    driver.navigate().refresh();
}
项目:SilkAppDriver    文件:ExceptionTests.java   
@Ignore // Ignored for now - delegates to executeScript currently (Selenium
        // 3.6) which it probably shouldn't
@Test(expected = UnsupportedCommandException.class)
public void testgetPageSourceNotSupported() {
    driver.getPageSource();
}
项目:SilkAppDriver    文件:ExceptionTests.java   
@Test(expected = UnsupportedCommandException.class)
public void testFindByCssNotSupported() {
    driver.findElement(By.cssSelector("test"));
}
项目:jwebrobot    文件:ReporterTest.java   
@Test
public void shouldNotThrowErrorIfBrowserLogForwardingIsNotSupportedByTheDriver() {
    when(logs.get(LogType.BROWSER)).thenThrow(UnsupportedCommandException.class);

    reporter.processLogEntries(context, actionReport);
}
项目:seleniumtestsframework    文件:ChromeDriverFactory.java   
protected void setPageLoadTimeout(final long timeout) {
    try {
        driver.manage().timeouts().pageLoadTimeout(timeout, TimeUnit.SECONDS);
    } catch (UnsupportedCommandException e) { }
}
项目:seleniumtestsframework    文件:IPhoneDriverFactory.java   
protected void setPageLoadTimeout(final long timeout) {
    try {
        driver.manage().timeouts().pageLoadTimeout(timeout, TimeUnit.SECONDS);
    } catch (UnsupportedCommandException e) {
    }
}
项目:seleniumtestsframework    文件:AndroidDriverFactory.java   
protected void setPageLoadTimeout(final long timeout) {
    try {
        driver.manage().timeouts().pageLoadTimeout(timeout, TimeUnit.SECONDS);
    } catch (UnsupportedCommandException e) {
    }
}
项目:selendroid    文件:SelendroidUnknownCommandHandlingTest.java   
@Test(expected = UnsupportedCommandException.class)
public void testShouldNotBeAbleToGoForward() {
  driver().navigate().forward();
}
项目:selendroid    文件:SelendroidUnknownCommandHandlingTest.java   
@Test(expected = UnsupportedCommandException.class)
public void shouldNotRefresh() {
  driver().navigate().refresh();
}
项目:selendroid    文件:SelendroidUnknownCommandHandlingTest.java   
@Test(expected = UnsupportedCommandException.class)
public void shouldNotActivateIMEEngine() {
  driver().manage().ime().activateEngine("selendroid");
}
项目:selendroid    文件:SelendroidUnknownCommandHandlingTest.java   
@Test(expected = UnsupportedCommandException.class)
public void shouldNotDeactivateIME() {
  driver().manage().ime().deactivate();
}
项目:selendroid    文件:SelendroidUnknownCommandHandlingTest.java   
@Test(expected = UnsupportedCommandException.class)
public void shouldNotGetActiveEngine() {
  driver().manage().ime().getActiveEngine();
}
项目:selendroid    文件:SelendroidUnknownCommandHandlingTest.java   
@Test(expected = UnsupportedCommandException.class)
public void shouldNotGetAvailableEngines() {
  driver().manage().ime().getAvailableEngines();
}
项目:selendroid    文件:SelendroidUnknownCommandHandlingTest.java   
@Test(expected = UnsupportedCommandException.class)
public void shouldNotGetActivatedStateOfIME() {
  driver().manage().ime().isActivated();
}
项目:selendroid    文件:SelendroidUnknownCommandHandlingTest.java   
@Test(expected = UnsupportedCommandException.class)
public void shouldNotGetWindowPosition() {
  driver().manage().window().getPosition();
}
项目:selendroid    文件:SelendroidUnknownCommandHandlingTest.java   
@Test(expected = UnsupportedCommandException.class)
public void shouldNotGetWindowsMaximizedState() {
  driver().manage().window().maximize();
}
项目:selendroid    文件:SelendroidUnknownCommandHandlingTest.java   
@Test(expected = UnsupportedCommandException.class)
public void testShouldNotSetPosition() {
  Point targetPosition = new Point(1, 2);
  driver().manage().window().setPosition(targetPosition);
}
项目:selendroid    文件:SelendroidUnknownCommandHandlingTest.java   
@Test(expected = UnsupportedCommandException.class)
public void testShouldNotSetSize() {
  Dimension targetSize = new Dimension(320, 480);
  driver().manage().window().setSize(targetSize);
}
项目:selendroid    文件:NavigationTests.java   
@Test(expected = UnsupportedCommandException.class)
public void shouldNotGoForwardInNativeMode() {
  openStartActivity();
  driver().navigate().forward();
}
项目:selendroid    文件:NavigationTests.java   
@Test(expected = UnsupportedCommandException.class)
public void shouldNotDoRefreshInNativeMode() {
  openStartActivity();
  driver().navigate().refresh();
}