Package com.sun.jna

Examples of com.sun.jna.WString


      populateArguments(result, scriptArgs, args);

      script = "(function() { return function(){" + script + "};})();";

      PointerByReference scriptResultRef = new PointerByReference();
      result = lib.wdExecuteScript(driver, new WString(script), scriptArgs, scriptResultRef);

      errors.verifyErrorCode(result, "Cannot execute script");
      return new JavascriptResultCollection(lib, this).extractReturnValue(scriptResultRef);
    } finally {
      lib.wdFreeScriptArgs(scriptArgs);
View Full Code Here


  }

  private int populateArguments(int result, Pointer scriptArgs, Object... args) {
    for (Object arg : args) {
      if (arg instanceof String) {
        result = lib.wdAddStringScriptArg(scriptArgs, new WString((String) arg));
      } else if (arg instanceof Boolean) {
        Boolean param = (Boolean) arg;
        result = lib.wdAddBooleanScriptArg(scriptArgs, param == null || !param ? 0 : 1);
      } else if (arg instanceof Double || arg instanceof Float) {
        Double number = ((Number) arg).doubleValue();
View Full Code Here

    }
    return result;
  }

  public void get(String url) {
    int result = lib.wdGet(driver, new WString(url));
    if (result != SUCCESS) {
      errors.verifyErrorCode(result, String.format("Cannot get \"%s\": %s", url, result));
    }
  }
View Full Code Here

    public WebDriver frame(int frameIndex) {
      return frame(String.valueOf(frameIndex));
    }

    public WebDriver frame(String frameName) {
      int result = lib.wdSwitchToFrame(driver, new WString(frameName));

      errors.verifyErrorCode(result, ("Unable to switch to frame: " + frameName));

      return InternetExplorerDriver.this;
    }
View Full Code Here

      return InternetExplorerDriver.this;
    }

    public WebDriver window(String windowName) {
      int result = lib.wdSwitchToWindow(driver, new WString(windowName));
      errors.verifyErrorCode(result, "Unable to locate window: " + windowName);
      return InternetExplorerDriver.this;
    }
View Full Code Here

    public void deleteCookieNamed(String name) {
      if (name == null) {
        throw new WebDriverException("Cookie to delete cannot be null");
      }

      int result = lib.wdDeleteCookie(driver, new WString(name));
      errors.verifyErrorCode(result, "Cannot delete cookie " + name);
    }
View Full Code Here

  }

  public String getAttribute(String name) {
    PointerByReference wrapper = new PointerByReference();
    int result = lib.wdeGetAttribute(
        parent.getDriverPointer(), element, new WString(name), wrapper);

    errors.verifyErrorCode(result, "get attribute of");

    return wrapper.getValue() == null ? null : new StringWrapper(lib, wrapper).toString();
  }
View Full Code Here

    StringBuilder builder = new StringBuilder();
    for (CharSequence seq : value) {
      builder.append(seq);
    }

    int result = lib.wdeSendKeys(element, new WString(builder.toString()));

    errors.verifyErrorCode(result, "send keys to");

    parent.waitForLoadToComplete();
  }
View Full Code Here

    return new Dimension(width.getValue().intValue(), height.getValue().intValue());
  }

  public String getValueOfCssProperty(String propertyName) {
    PointerByReference wrapper = new PointerByReference();
    int result = lib.wdeGetValueOfCssProperty(element, new WString(propertyName), wrapper);
    errors.verifyErrorCode(result, ("Unable to get value of css property: " + propertyName));

    return new StringWrapper(lib, wrapper).toString();
  }
View Full Code Here

      throw new IllegalLocatorException(
          "Compound class names are not supported. Consider searching for one class name and filtering the results.");
    }

    PointerByReference rawElement = new PointerByReference();
    int result = lib.wdFindElementByClassName(driver, element, new WString(using), rawElement);

    handleErrorCode("class name", using, result);

    return new InternetExplorerElement(lib, parent, rawElement.getValue());
  }
View Full Code Here

TOP

Related Classes of com.sun.jna.WString

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.