org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of selenium-remote-driver Show documentation
Show all versions of selenium-remote-driver Show documentation
Selenium automates browsers. That's it! What you do with that power is entirely up to you.
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The SFC licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.openqa.selenium.remote.codec.w3c;
import static java.net.HttpURLConnection.HTTP_BAD_GATEWAY;
import static java.net.HttpURLConnection.HTTP_BAD_METHOD;
import static java.net.HttpURLConnection.HTTP_GATEWAY_TIMEOUT;
import static java.net.HttpURLConnection.HTTP_INTERNAL_ERROR;
import static org.openqa.selenium.json.Json.MAP_TYPE;
import static org.openqa.selenium.json.Json.OBJECT_TYPE;
import static org.openqa.selenium.remote.http.Contents.string;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Function;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.openqa.selenium.UnhandledAlertException;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.json.Json;
import org.openqa.selenium.remote.ErrorCodec;
import org.openqa.selenium.remote.ErrorCodes;
import org.openqa.selenium.remote.JsonToWebElementConverter;
import org.openqa.selenium.remote.Response;
import org.openqa.selenium.remote.codec.AbstractHttpResponseCodec;
import org.openqa.selenium.remote.http.HttpHeader;
import org.openqa.selenium.remote.http.HttpResponse;
/**
* A response codec that adheres to the W3C WebDriver wire protocol.
*
* @see W3C WebDriver spec
*/
public class W3CHttpResponseCodec extends AbstractHttpResponseCodec {
// Commands that need special handling:
// * Get Window Size
// * Set Window Size
// * Get Window Position
// * Set Window Position
// * Maximise Window
// * Full screen window
// * Get Active Element
// * Possibly find element
// * Get Element Rect
// * Get Page Source
// * Get All Cookies
// * Get Named Cookie
// I've not checked the actions apis yet
private static final Logger LOG = Logger.getLogger(W3CHttpResponseCodec.class.getName());
private final ErrorCodec errorCodec = ErrorCodec.createDefault();
private final ErrorCodes errorCodes = new ErrorCodes();
private final Json json = new Json();
private final Function
© 2015 - 2024 Weber Informatics LLC | Privacy Policy