Package org.openqa.selenium

Examples of org.openqa.selenium.WebDriverException


      or.put(c.stringify());
    }
    try {
      res.put(type.toString(), or);
    }catch (JSONException e) {
      throw new WebDriverException(e);
    }
  
    return res;
  }
View Full Code Here


      res.put("method", propertyName);
      res.put("expected", value);
      res.put("l10n", l10nstrategy);
      res.put("matching", matchingStrategy);
    } catch (JSONException e) {
      throw new WebDriverException(e);
    }
    return res;
  }
View Full Code Here

        return (T) buildPropertyBaseCriteria(serialized, c, decorator);
      default:
        throw new InvalidSelectorException("can't find the type : " + serialized.toString());
      }
    } catch (Exception e) {
      throw new WebDriverException(e);
    }

  }
View Full Code Here

    JSONObject wdLogMessageJson = new JSONObject();
    try {
      wdLogMessageJson.put("message", inspectorMessageJson);
      wdLogMessageJson.put("webview", pageKey);
    } catch (JSONException ex) {
      throw new WebDriverException(ex);
    }
    log.addEntry(Level.INFO, wdLogMessageJson.toString());
  }
View Full Code Here

            response = new JSONObject()
                .put("id",id)
                .put("error",new JSONObject()
                                    .put("message","Webkit has been terminated"));
          } catch (JSONException e) {
            throw new WebDriverException(e);
          }
          return;
        }
        if (System.currentTimeMillis() > end) {
          exception =
              new WebDriverException("timeout (" + timeout + "ms) waiting for a response for request id: " + id);
          return;
        }
        try {
          Thread.sleep(10);
          for (JSONObject o : responses) {
View Full Code Here

                    desired = page;
                    break;
                  }
                }
                if (desired == null) {
                  throw new WebDriverException("unknown pageId:" + pageId);
                }
                String title = desired.getTitle();
                By locator = By.xpath("//UIAStaticText[@name='" + title + "']");
                getNativeDriver().executeScript(
                    "new SafariPageNavigator().enter();");

                WebElement element = getNativeDriver().findElement(locator);
                try {
                  getIOSDualDriver().setMode(WorkingMode.Native);
                  element.click();
                } finally {
                  getIOSDualDriver().setMode(WorkingMode.Web);
                }
                break;
              default:
                throw new WebDriverException("Cannot switch pages on version " + version);
            }
          } else {
            // TODO?
          }
        }
View Full Code Here

    return connectionId;
  }

  public void register() {
    if (connectionId != null) {
      throw new WebDriverException("Session already created.");
    }
    connectionId = UUID.randomUUID().toString();

    Map<String, String> var = ImmutableMap.of("$WIRConnectionIdentifierKey", connectionId);
    sendSystemCommand(PlistManager.SET_CONNECTION_KEY, var);
View Full Code Here

    sendSystemCommand(PlistManager.SET_CONNECTION_KEY, var);
  }

  public void connect(String bundleId) {
    if (connectionId == null) {
      throw new WebDriverException("Cannot connect to app " + bundleId + ".Call register first.");
    }
    Map<String, String> var = ImmutableMap.of
        (
            "$WIRConnectionIdentifierKey", this.connectionId,
            "$bundleId", bundleId
View Full Code Here

  }

  public void attachToPage(int pageId) {
    String senderKey = generateSenderString(pageId);
    if (connectionId == null || bundleId == null) {
      throw new WebDriverException("You need to call register and connect first.");
    }

    Map<String, String> var = ImmutableMap.of
        (
            "$WIRConnectionIdentifierKey", connectionId,
View Full Code Here

      JSONObject response = handler.getResponse(command.getInt("id"));
      JSONObject error = response.optJSONObject("error");
      if (error != null) {
        throw new RemoteExceptionException(error, command);
      } else if (response.optBoolean("wasThrown", false)) {
        throw new WebDriverException("remote JS exception " + response.toString(2));
      } else {
        if (log.isLoggable(Level.FINE)) {
          log.fine(
              System.currentTimeMillis() + "\t\t" + (System.currentTimeMillis() - start) + "ms\t"
              + command.getString("method") + " " + command);
        }
        JSONObject res = response.getJSONObject("result");
        if (res == null) {
          System.err.println("GOT a null result from " + response.toString(2));
        }
        return res;
      }
    } catch (JSONException e) {
      throw new WebDriverException(e);
    } catch (NullPointerException e) {
      throw new WebDriverException("the server didn't respond. Is the app still alive ?");
    }
  }
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.