Package org.openqa.selenium

Examples of org.openqa.selenium.WebDriverException


    public String getScreenshot() {
      try {
        byte[] raw = service.takeScreenshot();
        return Base64.encodeBase64String(raw);
      } catch (Exception e) {
        throw new WebDriverException("Couldn't take the screenshot : " + e.getMessage(), e);
      }
    }
View Full Code Here


    return windowHandles;
  }

  public String getWindowHandle() {
    if (windowHandle == null) {
      throw new WebDriverException("don't know the current window.");
    }
    return windowHandle;
  }
View Full Code Here

    InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
    StringWriter writer = new StringWriter();
    try {
      IOUtils.copy(is, writer, ENCODING);
    } catch (IOException e) {
      throw new WebDriverException("Cannot load script :" + resource, e);
    }
    String content = writer.toString();
    return content;
  }
View Full Code Here

      throws WebDriverException {
    if (!DeviceVariation.compatibleWithSDKVersion(device, variation, desiredSDKVersion)) {
      DeviceVariation
          compatibleVariation =
          DeviceVariation.getCompatibleVersion(device, desiredSDKVersion);
      throw new WebDriverException(
          String.format("%s variation incompatible with SDK %s, a compatible variation is %s",
                        DeviceVariation.deviceString(device, variation, instrumentsVersion.getMajor()),
                        desiredSDKVersion, compatibleVariation));
    }
    return DeviceVariation.deviceString(device, variation, instrumentsVersion.getMajor());
View Full Code Here

    HttpResponse response = client.execute(h, r);

    JSONObject o = Helper.extractObject(response);
    String id = o.optString("sessionId");
    if (id == null) {
      throw new WebDriverException("cannot guess the sessionId for the IDE to use.");
    }
    return new Session(id);
  }
View Full Code Here

          new BufferedWriter(new OutputStreamWriter(new FileOutputStream(res), ENCODING));
      writer.write(content);
      writer.close();
      return res;
    } catch (Exception e) {
      throw new WebDriverException("Cannot generate script.");
    }
  }
View Full Code Here

  public File getScript(int port, String aut, String opaqueKey, CommunicationMode mode,boolean acceptSslCerts) {
    try {
      String content = generateScriptContent(port, aut, opaqueKey, mode,acceptSslCerts);
      return createTmpScript(content);
    } catch (Exception e) {
      throw new WebDriverException("cannot generate the script for instrument.", e);
    }
  }
View Full Code Here

        }
        return res;
      }

    }
    throw new WebDriverException("timeout getting the response");
  }
View Full Code Here

      switch (payload.optString("direction")) {
        case "up": template = scrollUpTemplate; break;
        case "down": template = scrollDownTemplate; break;
        case "left": template = scrollLeftTemplate; break;
        case "right": template = scrollRightTemplate; break;
        default: throw new WebDriverException("Invalid value for scrolling direction");
      }
      js = template.generate(sessionId, reference);
    } else if (payload.has("name")) {
      String name = payload.optString("name");
      js = scrollToNameTemplate.generate(sessionId, reference, name);
    } else if (payload.has("predicateString")) {
      String predicateString = payload.optString("predicateString");
      js = scrollToPredicateTemplate.generate(sessionId, reference, predicateString);
    } else if (payload.has("toVisible")) {
      js = scrollToVisibleTemplate.generate(sessionId, reference);
    } else {
      throw new WebDriverException("Unrecognised payload for ELEMENT_SCROLL");
    }
    setJS(js);
  }
View Full Code Here

      return "." + value;
    }
    if ("name".equals(type)) {
      return "[name='" + value + "']";
    }
    throw new WebDriverException("NI , selector type " + type);
  }
View Full Code Here

TOP

Related Classes of org.openqa.selenium.WebDriverException

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.