Example usage for org.openqa.selenium UnsupportedCommandException UnsupportedCommandException

List of usage examples for org.openqa.selenium UnsupportedCommandException UnsupportedCommandException

Introduction

In this page you can find the example usage for org.openqa.selenium UnsupportedCommandException UnsupportedCommandException.

Prototype

public UnsupportedCommandException(Throwable cause) 

Source Link

Usage

From source file:com.opera.core.systems.scope.services.ums.CoreUtils.java

License:Apache License

public String getCoreVersion() {
    if (!browserInformation.hasCoreVersion()) {
        throw new UnsupportedCommandException("not available in this product");
    }/*  w  w w .j  av  a2  s  . c om*/
    return browserInformation.getCoreVersion();
}

From source file:com.opera.core.systems.scope.services.ums.CoreUtils.java

License:Apache License

public String getOperatingSystem() {
    if (!browserInformation.hasOperatingSystem()) {
        throw new UnsupportedCommandException("not available in this product");
    }// ww  w .ja  va2  s .  c  om
    return browserInformation.getOperatingSystem();
}

From source file:com.opera.core.systems.scope.services.ums.CoreUtils.java

License:Apache License

public String getProduct() {
    if (!browserInformation.hasProduct()) {
        throw new UnsupportedCommandException("not available in this product");
    }//from   w ww.  j ava2  s. co m
    return browserInformation.getProduct();
}

From source file:com.opera.core.systems.scope.services.ums.CoreUtils.java

License:Apache License

public String getBinaryPath() {
    if (!browserInformation.hasBinaryPath()) {
        throw new UnsupportedCommandException("not available in this product");
    }/*from  w w  w  . java  2s .c  om*/
    return browserInformation.getBinaryPath();
}

From source file:com.opera.core.systems.scope.services.ums.CoreUtils.java

License:Apache License

public String getUserAgent() {
    if (!browserInformation.hasUserAgent()) {
        throw new UnsupportedCommandException("not available in this product");
    }//from w w  w. j  av a2  s .  c  o m
    return browserInformation.getUserAgent();
}

From source file:com.opera.core.systems.scope.services.ums.CoreUtils.java

License:Apache License

public Integer getProcessID() {
    if (!browserInformation.hasProcessID()) {
        throw new UnsupportedCommandException("not available in this product");
    }//from w w w. j ava2s.  c o  m
    return browserInformation.getProcessID();
}

From source file:com.opera.core.systems.scope.services.ums.OperaExec.java

License:Apache License

public void action(String using, int data, String dataString, String dataStringParam) {
    if (!actions.contains(using)) {
        throw new UnsupportedCommandException("The requested action is not supported: " + using);
    }/*from   w  w w  .  j a va  2s. c  om*/

    ActionList.Builder builder = ActionList.newBuilder();
    Action.Builder actionBuilder = Action.newBuilder();
    actionBuilder.setName(using);
    actionBuilder.setValue(dataString);
    actionBuilder.setData(data);
    actionBuilder.setStringParam(dataStringParam);

    // type.setSpace("preserve");
    builder.addActionList(actionBuilder);
    if (executeCommand(ExecCommand.EXEC, builder) == null) {
        throw new WebDriverException("Unexpected error while calling action: " + using);
    }
}

From source file:com.seleniumtests.ut.uipage.htmlelements.TestCompositeActions.java

License:Apache License

/**
 * Test replay of CompositeAction in fallback mode
 *//*  w  w w .j  a va 2 s .  co  m*/
@Test(groups = { "ut" })
public void testReplayOnSearch() {

    // force fallback to old behaviour: used by chrome as of version 62
    doThrow(new UnsupportedCommandException("not supported")).when(eventDriver).perform(anyCollection());
    when(element.getCoordinates()).thenThrow(WebDriverException.class).thenThrow(WebDriverException.class)
            .thenReturn(coordinates);
    new Actions(eventDriver).click(element).perform();

    // coordinates search is done 3 times, because of errors
    verify(element, atLeast(3)).getCoordinates();

}

From source file:com.seleniumtests.ut.uipage.htmlelements.TestCompositeActions.java

License:Apache License

/**
 * Test replay in fallback mode when error occurs in any part of the action (except search)
 *///from   w  ww.  j av a2s .co m
@Test(groups = { "ut" })
public void testReplayOnPerform() {
    when(element.getCoordinates()).thenReturn(coordinates);

    // force fallback to old behaviour: used by chrome as of version 62
    doThrow(new UnsupportedCommandException("not supported")).when(eventDriver).perform(anyCollection());
    doThrow(new WebDriverException("error clicking")).doNothing().when(mouse).click(coordinates);

    new Actions(eventDriver).click(element).perform();

    verify(mouse, times(2)).click(coordinates);
}

From source file:org.uiautomation.ios.server.command.web.SetFrameHandler.java

License:Apache License

@Override
public Response handle() throws Exception {
    Object p = getRequest().getPayload().get("id");

    if (JSONObject.NULL.equals(p)) {
        getSession().getRemoteWebDriver().getContext().setCurrentFrame(null, null, null);
    } else {//w ww.  j av  a2  s  .c o  m
        RemoteWebElement iframe;
        if (p instanceof String) {
            iframe = getIframe((String) p);
        } else if (p instanceof Integer) {
            iframe = getIframe((Integer) p);
        } else if (p instanceof JSONObject) {
            String id = ((JSONObject) p).getString("ELEMENT");
            iframe = getSession().getRemoteWebDriver().createElement(id);
        } else {
            throw new UnsupportedCommandException("not supported : frame selection by " + p.getClass());
        }

        RemoteWebElement document = iframe.getContentDocument();
        RemoteWebElement window = iframe.getContentWindow();
        getSession().getRemoteWebDriver().getContext().setCurrentFrame(iframe, document, window);
    }

    Response res = new Response();
    res.setSessionId(getSession().getSessionId());
    res.setStatus(0);
    res.setValue(new JSONObject());
    return res;
}