Refine search
/** * @param target * If relative, resolved against the location of the symlink. * If absolute, it's absolute. * @throws UnsatisfiedLinkError * If the function is not exported by kernel32. * See http://msdn.microsoft.com/en-us/library/windows/desktop/aa363866(v=vs.85).aspx * for compatibility info. * @deprecated Use {@link Util#createSymlink} instead. */ @Deprecated public static void createSymbolicLink(File symlink, String target, boolean dirLink) throws IOException { if (!Kernel32.INSTANCE.CreateSymbolicLinkW( new WString(symlink.getPath()), new WString(target), dirLink?Kernel32.SYMBOLIC_LINK_FLAG_DIRECTORY:0)) { throw new WinIOException("Failed to create a symlink "+symlink+" to "+target); } }
/** Create a native string as a NUL-terminated array of * <code>wchar_t</code>. */ public NativeString(WString string) { this(string.toString(), WIDE_STRING); }
public WebElement findElementByClassName(String using) { if (using == null) throw new IllegalArgumentException("Cannot find elements when the class name expression is null."); if (using.matches(".*\\s+.*")) { 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("id", using, result); return new InternetExplorerElement(lib, parent, rawElement.getValue()); }
public static UserInfo getUserInfo(String accountName, String domainName) { PointerByReference bufptr = new PointerByReference(); int rc = -1; try { rc = Netapi32.INSTANCE.NetUserGetInfo(domainName, accountName, (short)23, bufptr); if (rc == LMErr.NERR_Success) { USER_INFO_23 info_23 = new USER_INFO_23(bufptr.getValue()); UserInfo userInfo = new UserInfo(); if (info_23.usri23_comment != null) { userInfo.comment = info_23.usri23_comment.toString(); userInfo.fullName = info_23.usri23_full_name.toString(); userInfo.name = info_23.usri23_name.toString(); if (bufptr.getValue() != Pointer.NULL) { Netapi32.INSTANCE.NetApiBufferFree(bufptr.getValue());
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(); }
public WebElement findElementById(String using) { PointerByReference rawElement = new PointerByReference(); int result = lib.wdFindElementById(driver, element, new WString(using), rawElement); handleErrorCode("id", using, result); return new InternetExplorerElement(lib, parent, rawElement.getValue()); }
public String getAttribute(String name) { PointerByReference wrapper = new PointerByReference(); int result = lib.wdeGetAttribute(element, new WString(name), wrapper); errors.verifyErrorCode(result, "get attribute of"); return new StringWrapper(lib, wrapper).toString(); }
public WebElement findElementByLinkText(String using) { PointerByReference rawElement = new PointerByReference(); int result = lib.wdFindElementByLinkText(driver, element, new WString(using), rawElement); handleErrorCode("link text", using, result); return new InternetExplorerElement(lib, parent, rawElement.getValue()); }
/** * @deprecated Use {@link java.nio.file.Files#readAttributes} with * {@link java.nio.file.attribute.DosFileAttributes} and reflective calls to * WindowsFileAttributes if necessary. */ @Deprecated public static int getWin32FileAttributes(File file) throws IOException { // allow lookup of paths longer than MAX_PATH // http://msdn.microsoft.com/en-us/library/aa365247(v=VS.85).aspx String canonicalPath = file.getCanonicalPath(); String path; if(canonicalPath.length() < 260) { // path is short, use as-is path = canonicalPath; } else if(canonicalPath.startsWith("\\\\")) { // network share // \\server\share --> \\?\UNC\server\share path = "\\\\?\\UNC\\" + canonicalPath.substring(2); } else { // prefix, canonical path should be normalized and absolute so this should work. path = "\\\\?\\" + canonicalPath; } return Kernel32.INSTANCE.GetFileAttributesW(new WString(path)); }
@Override public int hashCode() { return toString().hashCode(); } @Override
public WebElement findElementByTagName(String using) { PointerByReference rawElement = new PointerByReference(); int result = lib.wdFindElementByTagName(driver, element, new WString(using), rawElement); handleErrorCode("xpath", using, result); return new InternetExplorerElement(lib, parent, rawElement.getValue()); }
@Override public int length() { return toString().length(); } @Override
public WebElement findElementByPartialLinkText(String using) { PointerByReference rawElement = new PointerByReference(); int result = lib.wdFindElementByPartialLinkText(driver, element, new WString(using), rawElement); handleErrorCode("link text", using, result); return new InternetExplorerElement(lib, parent, rawElement.getValue()); }
@Override public Object toNative(Object value, ToNativeContext context) { if (value == null) return null; if (value instanceof String[]) { return new StringArray((String[])value, true); } return new WString(value.toString()); } @Override