/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #![allow(missing_docs)] use std::collections::HashMap; use cookie::Cookie; use euclid::default::Rect; use hyper_serde::Serde; use ipc_channel::ipc::IpcSender; use msg::constellation_msg::BrowsingContextId; use serde::{Deserialize, Serialize}; use servo_url::ServoUrl; use webdriver::common::{WebElement, WebFrame, WebWindow}; use webdriver::error::ErrorStatus; #[derive(Debug, Deserialize, Serialize)] pub enum WebDriverScriptCommand { AddCookie( #[serde( deserialize_with = "::hyper_serde::deserialize", serialize_with = "::hyper_serde::serialize" )] Cookie<'static>, IpcSender>, ), DeleteCookies(IpcSender>), ExecuteScript(String, IpcSender), ExecuteAsyncScript(String, IpcSender), FindElementCSS(String, IpcSender, ErrorStatus>>), FindElementLinkText(String, bool, IpcSender, ErrorStatus>>), FindElementTagName(String, IpcSender, ErrorStatus>>), FindElementsCSS(String, IpcSender, ErrorStatus>>), FindElementsLinkText(String, bool, IpcSender, ErrorStatus>>), FindElementsTagName(String, IpcSender, ErrorStatus>>), FindElementElementCSS( String, String, IpcSender, ErrorStatus>>, ), FindElementElementLinkText( String, String, bool, IpcSender, ErrorStatus>>, ), FindElementElementTagName( String, String, IpcSender, ErrorStatus>>, ), FindElementElementsCSS(String, String, IpcSender, ErrorStatus>>), FindElementElementsLinkText( String, String, bool, IpcSender, ErrorStatus>>, ), FindElementElementsTagName(String, String, IpcSender, ErrorStatus>>), FocusElement(String, IpcSender>), ElementClick(String, IpcSender, ErrorStatus>>), GetActiveElement(IpcSender>), GetCookie(String, IpcSender>>>), GetCookies(IpcSender>>>), GetElementAttribute( String, String, IpcSender, ErrorStatus>>, ), GetElementProperty( String, String, IpcSender>, ), GetElementCSS(String, String, IpcSender>), GetElementRect(String, IpcSender, ErrorStatus>>), GetElementTagName(String, IpcSender>), GetElementText(String, IpcSender>), GetElementInViewCenterPoint(String, IpcSender, ErrorStatus>>), GetBoundingClientRect(String, IpcSender, ErrorStatus>>), GetBrowsingContextId( WebDriverFrameId, IpcSender>, ), GetUrl(IpcSender), GetPageSource(IpcSender>), IsEnabled(String, IpcSender>), IsSelected(String, IpcSender>), GetTitle(IpcSender), } #[derive(Debug, Deserialize, Serialize)] pub enum WebDriverCookieError { InvalidDomain, UnableToSetCookie, } #[derive(Clone, Debug, Deserialize, Serialize)] pub enum WebDriverJSValue { Undefined, Null, Boolean(bool), Number(f64), String(String), Element(WebElement), Frame(WebFrame), Window(WebWindow), ArrayLike(Vec), Object(HashMap), } #[derive(Debug, Deserialize, Serialize)] pub enum WebDriverJSError { /// Occurs when handler received an event message for a layout channel that is not /// associated with the current script thread BrowsingContextNotFound, JSError, StaleElementReference, Timeout, UnknownType, } pub type WebDriverJSResult = Result; #[derive(Debug, Deserialize, Serialize)] pub enum WebDriverFrameId { Short(u16), Element(String), Parent, } #[derive(Debug, Deserialize, Serialize)] pub enum LoadStatus { LoadComplete, LoadTimeout, }