当前位置: 首页>>代码示例>>Java>>正文


Java UnsupportedCommandException类代码示例

本文整理汇总了Java中org.openqa.selenium.UnsupportedCommandException的典型用法代码示例。如果您正苦于以下问题:Java UnsupportedCommandException类的具体用法?Java UnsupportedCommandException怎么用?Java UnsupportedCommandException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UnsupportedCommandException类属于org.openqa.selenium包,在下文中一共展示了UnsupportedCommandException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: elementClearOnNonClearableComponents

import org.openqa.selenium.UnsupportedCommandException; //导入依赖的package包/类
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) {

    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:17,代码来源:JavaDriverTest.java

示例2: isSelectedOnNonSelectableComponents

import org.openqa.selenium.UnsupportedCommandException; //导入依赖的package包/类
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) {

    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:17,代码来源:JavaDriverTest.java

示例3: handle

import org.openqa.selenium.UnsupportedCommandException; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:google,项目名称:devtools-driver,代码行数:28,代码来源:SetTimeoutHandler.java

示例4: processLogEntries

import org.openqa.selenium.UnsupportedCommandException; //导入依赖的package包/类
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!");
    }
}
 
开发者ID:automate-website,项目名称:jwebrobot,代码行数:24,代码来源:Reporter.java

示例5: setPageLoadTimeout

import org.openqa.selenium.UnsupportedCommandException; //导入依赖的package包/类
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 :
    }
}
 
开发者ID:tarun3kumar,项目名称:seleniumtestsframework,代码行数:21,代码来源:RemoteDriverFactory.java

示例6: switchToParentFrame

import org.openqa.selenium.UnsupportedCommandException; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:Nordstrom,项目名称:Selenium-Foundation,代码行数:24,代码来源:Frame.java

示例7: unsupportedPseudoElement

import org.openqa.selenium.UnsupportedCommandException; //导入依赖的package包/类
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) {

    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:10,代码来源:JListXTest.java

示例8: handle

import org.openqa.selenium.UnsupportedCommandException; //导入依赖的package包/类
@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;
}
 
开发者ID:google,项目名称:devtools-driver,代码行数:34,代码来源:SetFrameHandler.java

示例9: testSideBarResize

import org.openqa.selenium.UnsupportedCommandException; //导入依赖的package包/类
@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!");

}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:31,代码来源:SideBarIT.java

示例10: testOverviewLayout

import org.openqa.selenium.UnsupportedCommandException; //导入依赖的package包/类
@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);
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:29,代码来源:SideBarIT.java

示例11: setPageLoadTimeout

import org.openqa.selenium.UnsupportedCommandException; //导入依赖的package包/类
protected void setPageLoadTimeout(final long timeout) {
    try {
        driver.manage().timeouts().pageLoadTimeout(timeout, TimeUnit.SECONDS);
    } catch (UnsupportedCommandException e) {
        // chromedriver does not support pageLoadTimeout
    }
}
 
开发者ID:tarun3kumar,项目名称:seleniumtestsframework,代码行数:8,代码来源:SauceLabsDriverFactory.java

示例12: terminate

import org.openqa.selenium.UnsupportedCommandException; //导入依赖的package包/类
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());
    }
  }

}
 
开发者ID:BenjaminLimb,项目名称:web-test-framework,代码行数:16,代码来源:Driver.java

示例13: setNetworkConnection

import org.openqa.selenium.UnsupportedCommandException; //导入依赖的package包/类
@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;
}
 
开发者ID:GiannisPapadakis,项目名称:seletest,代码行数:16,代码来源:AppiumDriverController.java

示例14: testGoNotSupported

import org.openqa.selenium.UnsupportedCommandException; //导入依赖的package包/类
@Test(expected = UnsupportedCommandException.class)
public void testGoNotSupported() {
	driver.navigate().to("http://www.google.at");
}
 
开发者ID:MicroFocus,项目名称:SilkAppDriver,代码行数:5,代码来源:ExceptionTests.java

示例15: testGetCurrentUrlNotSupported

import org.openqa.selenium.UnsupportedCommandException; //导入依赖的package包/类
@Test(expected = UnsupportedCommandException.class)
public void testGetCurrentUrlNotSupported() {
	driver.getCurrentUrl();
}
 
开发者ID:MicroFocus,项目名称:SilkAppDriver,代码行数:5,代码来源:ExceptionTests.java


注:本文中的org.openqa.selenium.UnsupportedCommandException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。