module Marionette

Overview

Marionette is a one-size-fits-all approach to WebDriver adapters. It works with most all web driver implementations, including:

See the README for information on getting started.

Extended Modules

Defined in:

Constant Summary

BasicCommands = {"Status" => {:get, "/status"}, "NewSession" => {:post, "/session"}, "GetAllSessions" => {:get, "/sessions"}, "Quit" => {:delete, SessionIdPath}, "GetCurrentWindowHandle" => {:get, SessionIdPath + "/window_handle"}, "W3CGetCurrentWindowHandle" => {:get, SessionIdPath + "/window"}, "GetWindowHandles" => {:get, SessionIdPath + "/window_handles"}, "W3CGetWindowHandles" => {:get, SessionIdPath + "/window/handles"}, "Get" => {:post, SessionIdPath + "/url"}, "GoForward" => {:post, SessionIdPath + "/forward"}, "GoBack" => {:post, SessionIdPath + "/back"}, "Refresh" => {:post, SessionIdPath + "/refresh"}, "ExecuteScript" => {:post, SessionIdPath + "/execute"}, "W3CExecuteScript" => {:post, SessionIdPath + "/execute/sync"}, "W3CExecuteScriptAsync" => {:post, SessionIdPath + "/execute/async"}, "GetCurrentUrl" => {:get, SessionIdPath + "/url"}, "GetTitle" => {:get, SessionIdPath + "/title"}, "GetPageSource" => {:get, SessionIdPath + "/source"}, "Screenshot" => {:get, SessionIdPath + "/screenshot"}, "ElementScreenshot" => {:get, (SessionIdPath + ElementIdPath) + "/screenshot"}, "FindElement" => {:post, SessionIdPath + "/element"}, "FindElements" => {:post, SessionIdPath + "/elements"}, "W3CGetActiveElement" => {:get, SessionIdPath + "/element/active"}, "GetActiveElement" => {:post, SessionIdPath + "/element/active"}, "FindChildElement" => {:post, (SessionIdPath + ElementIdPath) + "/element"}, "FindChildElements" => {:post, (SessionIdPath + ElementIdPath) + "/elements"}, "ClickElement" => {:post, (SessionIdPath + ElementIdPath) + "/click"}, "ClearElement" => {:post, (SessionIdPath + ElementIdPath) + "/clear"}, "SubmitElement" => {:post, (SessionIdPath + ElementIdPath) + "/submit"}, "GetElementText" => {:get, (SessionIdPath + ElementIdPath) + "/text"}, "SendKeysToElement" => {:post, (SessionIdPath + ElementIdPath) + "/value"}, "SendKeysToActiveElement" => {:post, SessionIdPath + "/keys"}, "UploadFile" => {:post, SessionIdPath + "/file"}, "GetElementValue" => {:get, (SessionIdPath + ElementIdPath) + "/value"}, "GetElementTagName" => {:get, (SessionIdPath + ElementIdPath) + "/name"}, "IsElementSelected" => {:get, (SessionIdPath + ElementIdPath) + "/selected"}, "SetElementSelected" => {:post, (SessionIdPath + ElementIdPath) + "/selected"}, "IsElementEnabled" => {:get, (SessionIdPath + ElementIdPath) + "/enabled"}, "IsElementDisplayed" => {:get, (SessionIdPath + ElementIdPath) + "/displayed"}, "GetElementLocation" => {:get, (SessionIdPath + ElementIdPath) + "/location"}, "GetElementLocationOnceScrolledIntoView" => {:get, (SessionIdPath + ElementIdPath) + "/location_in_view"}, "GetElementSize" => {:get, (SessionIdPath + ElementIdPath) + "/size"}, "GetElementRect" => {:get, (SessionIdPath + ElementIdPath) + "/rect"}, "GetElementAttribute" => {:get, ((SessionIdPath + ElementIdPath) + "/attribute/") + NameTag}, "GetElementProperty" => {:get, ((SessionIdPath + ElementIdPath) + "/property/") + NameTag}, "GetAllCookies" => {:get, SessionIdPath + "/cookie"}, "AddCookie" => {:post, SessionIdPath + "/cookie"}, "GetCookie" => {:get, (SessionIdPath + "/cookie/") + NameTag}, "DeleteAllCookies" => {:delete, SessionIdPath + "/cookie"}, "DeleteCookie" => {:delete, (SessionIdPath + "/cookie/") + NameTag}, "SwitchToFrame" => {:post, SessionIdPath + "/frame"}, "SwitchToParentFrame" => {:post, SessionIdPath + "/frame/parent"}, "SwitchToWindow" => {:post, SessionIdPath + "/window"}, "NewWindow" => {:post, SessionIdPath + "/window/new"}, "Close" => {:delete, SessionIdPath + "/window"}, "GetElementValueOfCssProperty" => {:get, ((SessionIdPath + ElementIdPath) + "/css/") + NameTag}, "ImplicitWait" => {:post, SessionIdPath + "/timeouts/implicit_wait"}, "ExecuteAsyncScript" => {:post, SessionIdPath + "/execute_async"}, "SetScriptTimeout" => {:post, SessionIdPath + "/timeouts/async_script"}, "SetTimeouts" => {:post, SessionIdPath + "/timeouts"}, "DismissAlert" => {:post, SessionIdPath + "/dismiss_alert"}, "W3CDismissAlert" => {:post, SessionIdPath + "/alert/dismiss"}, "AcceptAlert" => {:post, SessionIdPath + "/accept_alert"}, "W3CAcceptAlert" => {:post, SessionIdPath + "/alert/accept"}, "SetAlertValue" => {:post, SessionIdPath + "/alert_text"}, "W3CSetAlertValue" => {:post, SessionIdPath + "/alert/text"}, "GetAlertText" => {:get, SessionIdPath + "/alert_text"}, "W3CGetAlertText" => {:get, SessionIdPath + "/alert/text"}, "SetAlertCredentials" => {:post, SessionIdPath + "/alert/credentials"}, "Click" => {:post, SessionIdPath + "/click"}, "W3CActions" => {:post, SessionIdPath + "/actions"}, "W3CClearActions" => {:delete, SessionIdPath + "/actions"}, "DoubleClick" => {:post, SessionIdPath + "/doubleclick"}, "MouseDown" => {:post, SessionIdPath + "/buttondown"}, "MouseUp" => {:post, SessionIdPath + "/buttonup"}, "MoveTo" => {:post, SessionIdPath + "/moveto"}, "GetWindowSize" => {:get, (SessionIdPath + WindowHandlePath) + "/size"}, "SetWindowSize" => {:post, (SessionIdPath + WindowHandlePath) + "/size"}, "GetWindowPosition" => {:get, (SessionIdPath + WindowHandlePath) + "/position"}, "SetWindowPosition" => {:post, (SessionIdPath + WindowHandlePath) + "/position"}, "SetWindowRect" => {:post, SessionIdPath + "/window/rect"}, "GetWindowRect" => {:get, SessionIdPath + "/window/rect"}, "MaximizeWindow" => {:post, (SessionIdPath + WindowHandlePath) + "/maximize"}, "W3CMaximizeWindow" => {:post, SessionIdPath + "/window/maximize"}, "SetScreenOrientation" => {:post, SessionIdPath + "/orientation"}, "GetScreenOrientation" => {:get, SessionIdPath + "/orientation"}, "SingleTap" => {:post, SessionIdPath + "/touch/click"}, "TouchDown" => {:post, SessionIdPath + "/touch/down"}, "TouchUp" => {:post, SessionIdPath + "/touch/up"}, "TouchMove" => {:post, SessionIdPath + "/touch/move"}, "TouchScroll" => {:post, SessionIdPath + "/touch/scroll"}, "DoubleTap" => {:post, SessionIdPath + "/touch/doubleclick"}, "LongPress" => {:post, SessionIdPath + "/touch/longclick"}, "Flick" => {:post, SessionIdPath + "/touch/flick"}, "ExecuteSql" => {:post, SessionIdPath + "/execute_sql"}, "GetLocation" => {:get, SessionIdPath + "/location"}, "SetLocation" => {:post, SessionIdPath + "/location"}, "GetAppCache" => {:get, SessionIdPath + "/application_cache"}, "GetAppCacheStatus" => {:get, SessionIdPath + "/application_cache/status"}, "ClearAppCache" => {:delete, SessionIdPath + "/application_cache/clear"}, "GetNetworkConnection" => {:get, SessionIdPath + "/network_connection"}, "SetNetworkConnection" => {:post, SessionIdPath + "/network_connection"}, "GetLocalStorageItem" => {:get, (SessionIdPath + "/local_storage/key/") + NameTag}, "RemoveLocalStorageItem" => {:delete, (SessionIdPath + "/local_storage/key/") + NameTag}, "GetLocalStorageKeys" => {:get, SessionIdPath + "/local_storage"}, "SetLocalStorageItem" => {:post, SessionIdPath + "/local_storage"}, "ClearLocalStorage" => {:delete, SessionIdPath + "/local_storage"}, "GetLocalStorageSize" => {:get, SessionIdPath + "/local_storage/size"}, "GetSessionStorageItem" => {:get, (SessionIdPath + "/session_storage/key/") + NameTag}, "RemoveSessionStorageItem" => {:delete, (SessionIdPath + "/session_storage/key/") + NameTag}, "GetSessionStorageKeys" => {:get, SessionIdPath + "/session_storage"}, "SetSessionStorageItem" => {:post, SessionIdPath + "/session_storage"}, "ClearSessionStorage" => {:delete, SessionIdPath + "/session_storage"}, "GetSessionStorageSize" => {:get, SessionIdPath + "/session_storage/size"}, "GetLog" => {:post, SessionIdPath + "/se/log"}, "GetAvailableLogTypes" => {:get, SessionIdPath + "/se/log/types"}, "CurrentContextHandle" => {:get, SessionIdPath + "/context"}, "ContextHandles" => {:get, SessionIdPath + "/contexts"}, "SwitchToContext" => {:post, SessionIdPath + "/context"}, "FullscreenWindow" => {:post, SessionIdPath + "/window/fullscreen"}, "MinimizeWindow" => {:post, SessionIdPath + "/window/minimize"}}
ChromiumCommands = BasicCommands.merge({"LaunchApp" => {:post, SessionIdPath + "/chromium/launch_app"}, "SetNetworkConditions" => {:post, SessionIdPath + "/chromium/network_conditions"}, "GetNetworkConditions" => {:get, SessionIdPath + "/chromium/network_conditions"}, "ExecuteCdpCommand" => {:post, SessionIdPath + "/goog/cdp/execute"}, "GetSinks" => {:get, SessionIdPath + "/goog/cast/get_sinks"}, "GetIssueMessage" => {:get, SessionIdPath + "/goog/cast/get_issue_message"}, "SetSinkToUse" => {:post, SessionIdPath + "/goog/cast/set_sink_to_use"}, "StartTabMirroring" => {:post, SessionIdPath + "/goog/cast/start_tab_mirroring"}, "StopCasting" => {:post, SessionIdPath + "/goog/cast/stop_casting"}})
Commands = {"Status" => "status", "NewSession" => "newSession", "GetAllSessions" => "getAllSessions", "DeleteSession" => "deleteSession", "NewWindow" => "newWindow", "Close" => "close", "Quit" => "quit", "Get" => "get", "GoBack" => "goBack", "GoForward" => "goForward", "Refresh" => "refresh", "AddCookie" => "addCookie", "GetCookie" => "getCookie", "GetAllCookies" => "getCookies", "DeleteCookie" => "deleteCookie", "DeleteAllCookies" => "deleteAllCookies", "FindElement" => "findElement", "FindElements" => "findElements", "FindChildElement" => "findChildElement", "FindChildElements" => "findChildElements", "ClearElement" => "clearElement", "ClickElement" => "clickElement", "SendKeysToElement" => "sendKeysToElement", "SendKeysToActiveElement" => "sendKeysToActiveElement", "SubmitElement" => "submitElement", "UploadFile" => "uploadFile", "GetCurrentWindowHandle" => "getCurrentWindowHandle", "W3CgetCurrentWindowHandle" => "w3cGetCurrentWindowHandle", "GetWindowHandles" => "getWindowHandles", "W3CgetWindowHandles" => "w3cGetWindowHandles", "GetWindowSize" => "getWindowSize", "W3CgetWindowSize" => "w3cGetWindowSize", "W3CgetWindowPosition" => "w3cGetWindowPosition", "GetWindowPosition" => "getWindowPosition", "SetWindowSize" => "setWindowSize", "W3CsetWindowSize" => "w3cSetWindowSize", "SetWindowRect" => "setWindowRect", "GetWindowRect" => "getWindowRect", "SetWindowPosition" => "setWindowPosition", "W3CsetWindowPosition" => "w3cSetWindowPosition", "SwitchToWindow" => "switchToWindow", "SwitchToFrame" => "switchToFrame", "SwitchToParentFrame" => "switchToParentFrame", "GetActiveElement" => "getActiveElement", "W3CgetActiveElement" => "w3cGetActiveElement", "GetCurrentUrl" => "getCurrentUrl", "GetPageSource" => "getPageSource", "GetTitle" => "getTitle", "ExecuteScript" => "executeScript", "W3CexecuteScript" => "w3cExecuteScript", "W3CexecuteScriptAsync" => "w3cExecuteScriptAsync", "GetElementText" => "getElementText", "GetElementValue" => "getElementValue", "GetElementTagName" => "getElementTagName", "SetElementSelected" => "setElementSelected", "IsElementSelected" => "isElementSelected", "IsElementEnabled" => "isElementEnabled", "IsElementDisplayed" => "isElementDisplayed", "GetElementLocation" => "getElementLocation", "GetElementLocationOnceScrolledIntoView" => "getElementLocationOnceScrolledIntoView", "GetElementSize" => "getElementSize", "GetElementRect" => "getElementRect", "GetElementAttribute" => "getElementAttribute", "GetElementProperty" => "getElementProperty", "GetElementValueOfCssProperty" => "getElementValueOfCssProperty", "Screenshot" => "screenshot", "ElementScreenshot" => "elementScreenshot", "ImplicitWait" => "implicitlyWait", "ExecuteAsyncScript" => "executeAsyncScript", "SetScriptTimeout" => "setScriptTimeout", "SetTimeouts" => "setTimeouts", "MaximizeWindow" => "windowMaximize", "W3CmaximizeWindow" => "w3cMaximizeWindow", "GetLog" => "getLog", "GetAvailableLogTypes" => "getAvailableLogTypes", "FullscreenWindow" => "fullscreenWindow", "MinimizeWindow" => "minimizeWindow", "DismissAlert" => "dismissAlert", "W3CdismissAlert" => "w3cDismissAlert", "AcceptAlert" => "acceptAlert", "W3CacceptAlert" => "w3cAcceptAlert", "SetAlertValue" => "setAlertValue", "W3CsetAlertValue" => "w3cSetAlertValue", "GetAlertText" => "getAlertText", "W3CgetAlertText" => "w3cGetAlertText", "SetAlertCredentials" => "setAlertCredentials", "W3Cactions" => "actions", "W3CclearActions" => "clearActionState", "Click" => "mouseClick", "DoubleClick" => "mouseDoubleClick", "MouseDown" => "mouseButtonDown", "MouseUp" => "mouseButtonUp", "MoveTo" => "mouseMoveTo", "SetScreenOrientation" => "setScreenOrientation", "GetScreenOrientation" => "getScreenOrientation", "SingleTap" => "touchSingleTap", "TouchDown" => "touchDown", "TouchUp" => "touchUp", "TouchMove" => "touchMove", "TouchScroll" => "touchScroll", "DoubleTap" => "touchDoubleTap", "LongPress" => "touchLongPress", "Flick" => "touchFlick", "ExecuteSql" => "executeSql", "GetLocation" => "getLocation", "SetLocation" => "setLocation", "GetAppCache" => "getAppCache", "GetAppCacheStatus" => "getAppCacheStatus", "ClearAppCache" => "clearAppCache", "GetLocalStorageItem" => "getLocalStorageItem", "RemoveLocalStorageItem" => "removeLocalStorageItem", "GetLocalStorageKeys" => "getLocalStorageKeys", "SetLocalStorageItem" => "setLocalStorageItem", "ClearLocalStorage" => "clearLocalStorage", "GetLocalStorageSize" => "getLocalStorageSize", "GetSessionStorageItem" => "getSessionStorageItem", "RemoveSessionStorageItem" => "removeSessionStorageItem", "GetSessionStorageKeys" => "getSessionStorageKeys", "SetSessionStorageItem" => "setSessionStorageItem", "ClearSessionStorage" => "clearSessionStorage", "GetSessionStorageSize" => "getSessionStorageSize", "GetNetworkConnection" => "getNetworkConnection", "SetNetworkConnection" => "setNetworkConnection", "CurrentContextHandle" => "getCurrentContextHandle", "ContextHandles" => "getContextHandles", "SwitchToContext" => "switchToContext", "GetContext" => "GET_CONTEXT", "SetContext" => "SET_CONTEXT", "ElementGetAnonymousChildren" => "ELEMENT_GET_ANONYMOUS_CHILDREN", "ElementFindAnonymousElementsByAttribute" => "ELEMENT_FIND_ANONYMOUS_ELEMENTS_BY_ATTRIBUTE", "InstallAddon" => "INSTALL_ADDON", "UninstallAddon" => "UNINSTALL_ADDON", "FullPageScreenshot" => "FULL_PAGE_SCREENSHOT", "GetPermissions" => "GET_PERMISSIONS", "SetPermissions" => "SET_PERMISSIONS", "AttachDebugger" => "ATTACH_DEBUGGER", "LaunchApp" => "launchApp", "SetNetworkConditions" => "setNetworkConditions", "GetNetworkConditions" => "getNetworkConditions", "ExecuteCdpCommand" => "executeCdpCommand", "GetSinks" => "getSinks", "GetIssueMessage" => "getIssueMessage", "SetSinkToUse" => "setSinkToUse", "StartTabMirroring" => "startTabMirroring", "StopCasting" => "stopCasting", "Pause" => "marionettePause"}
DEVICE_DESCRIPTORS = {"Blackberry PlayBook" => {name: "Blackberry PlayBook", user_agent: "Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/7.2.1.0 Safari/536.2+", viewport: {width: 600, height: 1024, device_scale_factor: 1, is_mobile: true, has_touch: true, is_landscape: false}}, "Blackberry PlayBook landscape" => {name: "Blackberry PlayBook landscape", user_agent: "Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/7.2.1.0 Safari/536.2+", viewport: {width: 1024, height: 600, device_scale_factor: 1, is_mobile: true, has_touch: true, is_landscape: true}}, "BlackBerry Z30" => {name: "BlackBerry Z30", user_agent: "Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/10.0.9.2372 Mobile Safari/537.10+", viewport: {width: 360, height: 640, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: false}}, "BlackBerry Z30 landscape" => {name: "BlackBerry Z30 landscape", user_agent: "Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/10.0.9.2372 Mobile Safari/537.10+", viewport: {width: 640, height: 360, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: true}}, "Galaxy Note 3" => {name: "Galaxy Note 3", user_agent: "Mozilla/5.0 (Linux; U; Android 4.3; en-us; SM-N900T Build/JSS15J) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", viewport: {width: 360, height: 640, device_scale_factor: 3, is_mobile: true, has_touch: true, is_landscape: false}}, "Galaxy Note 3 landscape" => {name: "Galaxy Note 3 landscape", user_agent: "Mozilla/5.0 (Linux; U; Android 4.3; en-us; SM-N900T Build/JSS15J) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", viewport: {width: 640, height: 360, device_scale_factor: 3, is_mobile: true, has_touch: true, is_landscape: true}}, "Galaxy Note II" => {name: "Galaxy Note II", user_agent: "Mozilla/5.0 (Linux; U; Android 4.1; en-us; GT-N7100 Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", viewport: {width: 360, height: 640, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: false}}, "Galaxy Note II landscape" => {name: "Galaxy Note II landscape", user_agent: "Mozilla/5.0 (Linux; U; Android 4.1; en-us; GT-N7100 Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", viewport: {width: 640, height: 360, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: true}}, "Galaxy S III" => {name: "Galaxy S III", user_agent: "Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", viewport: {width: 360, height: 640, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: false}}, "Galaxy S III landscape" => {name: "Galaxy S III landscape", user_agent: "Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", viewport: {width: 640, height: 360, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: true}}, "Galaxy S5" => {name: "Galaxy S5", user_agent: "Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36", viewport: {width: 360, height: 640, device_scale_factor: 3, is_mobile: true, has_touch: true, is_landscape: false}}, "Galaxy S5 landscape" => {name: "Galaxy S5 landscape", user_agent: "Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36", viewport: {width: 640, height: 360, device_scale_factor: 3, is_mobile: true, has_touch: true, is_landscape: true}}, "iPad" => {name: "iPad", user_agent: "Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1", viewport: {width: 768, height: 1024, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: false}}, "iPad landscape" => {name: "iPad landscape", user_agent: "Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1", viewport: {width: 1024, height: 768, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: true}}, "iPad Mini" => {name: "iPad Mini", user_agent: "Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1", viewport: {width: 768, height: 1024, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: false}}, "iPad Mini landscape" => {name: "iPad Mini landscape", user_agent: "Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1", viewport: {width: 1024, height: 768, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: true}}, "iPad Pro" => {name: "iPad Pro", user_agent: "Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1", viewport: {width: 1024, height: 1366, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: false}}, "iPad Pro landscape" => {name: "iPad Pro landscape", user_agent: "Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1", viewport: {width: 1366, height: 1024, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: true}}, "iPhone 4" => {name: "iPhone 4", user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53", viewport: {width: 320, height: 480, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: false}}, "iPhone 4 landscape" => {name: "iPhone 4 landscape", user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53", viewport: {width: 480, height: 320, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: true}}, "iPhone 5" => {name: "iPhone 5", user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1", viewport: {width: 320, height: 568, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: false}}, "iPhone 5 landscape" => {name: "iPhone 5 landscape", user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1", viewport: {width: 568, height: 320, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: true}}, "iPhone 6" => {name: "iPhone 6", user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1", viewport: {width: 375, height: 667, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: false}}, "iPhone 6 landscape" => {name: "iPhone 6 landscape", user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1", viewport: {width: 667, height: 375, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: true}}, "iPhone 6 Plus" => {name: "iPhone 6 Plus", user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1", viewport: {width: 414, height: 736, device_scale_factor: 3, is_mobile: true, has_touch: true, is_landscape: false}}, "iPhone 6 Plus landscape" => {name: "iPhone 6 Plus landscape", user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1", viewport: {width: 736, height: 414, device_scale_factor: 3, is_mobile: true, has_touch: true, is_landscape: true}}, "iPhone 7" => {name: "iPhone 7", user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1", viewport: {width: 375, height: 667, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: false}}, "iPhone 7 landscape" => {name: "iPhone 7 landscape", user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1", viewport: {width: 667, height: 375, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: true}}, "iPhone 7 Plus" => {name: "iPhone 7 Plus", user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1", viewport: {width: 414, height: 736, device_scale_factor: 3, is_mobile: true, has_touch: true, is_landscape: false}}, "iPhone 7 Plus landscape" => {name: "iPhone 7 Plus landscape", user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1", viewport: {width: 736, height: 414, device_scale_factor: 3, is_mobile: true, has_touch: true, is_landscape: true}}, "iPhone 8" => {name: "iPhone 8", user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1", viewport: {width: 375, height: 667, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: false}}, "iPhone 8 landscape" => {name: "iPhone 8 landscape", user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1", viewport: {width: 667, height: 375, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: true}}, "iPhone 8 Plus" => {name: "iPhone 8 Plus", user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1", viewport: {width: 414, height: 736, device_scale_factor: 3, is_mobile: true, has_touch: true, is_landscape: false}}, "iPhone 8 Plus landscape" => {name: "iPhone 8 Plus landscape", user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1", viewport: {width: 736, height: 414, device_scale_factor: 3, is_mobile: true, has_touch: true, is_landscape: true}}, "iPhone SE" => {name: "iPhone SE", user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1", viewport: {width: 320, height: 568, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: false}}, "iPhone SE landscape" => {name: "iPhone SE landscape", user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1", viewport: {width: 568, height: 320, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: true}}, "iPhone X" => {name: "iPhone X", user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1", viewport: {width: 375, height: 812, device_scale_factor: 3, is_mobile: true, has_touch: true, is_landscape: false}}, "iPhone X landscape" => {name: "iPhone X landscape", user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1", viewport: {width: 812, height: 375, device_scale_factor: 3, is_mobile: true, has_touch: true, is_landscape: true}}, "JioPhone 2" => {name: "JioPhone 2", user_agent: "Mozilla/5.0 (Mobile; LYF/F300B/LYF-F300B-001-01-15-130718-i;Android; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.5", viewport: {width: 240, height: 320, device_scale_factor: 1, is_mobile: true, has_touch: true, is_landscape: false}}, "JioPhone 2 landscape" => {name: "JioPhone 2 landscape", user_agent: "Mozilla/5.0 (Mobile; LYF/F300B/LYF-F300B-001-01-15-130718-i;Android; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.5", viewport: {width: 320, height: 240, device_scale_factor: 1, is_mobile: true, has_touch: true, is_landscape: true}}, "Kindle Fire HDX" => {name: "Kindle Fire HDX", user_agent: "Mozilla/5.0 (Linux; U; en-us; KFAPWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true", viewport: {width: 800, height: 1280, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: false}}, "Kindle Fire HDX landscape" => {name: "Kindle Fire HDX landscape", user_agent: "Mozilla/5.0 (Linux; U; en-us; KFAPWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true", viewport: {width: 1280, height: 800, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: true}}, "LG Optimus L70" => {name: "LG Optimus L70", user_agent: "Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3765.0 Mobile Safari/537.36", viewport: {width: 384, height: 640, device_scale_factor: 1.25, is_mobile: true, has_touch: true, is_landscape: false}}, "LG Optimus L70 landscape" => {name: "LG Optimus L70 landscape", user_agent: "Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3765.0 Mobile Safari/537.36", viewport: {width: 640, height: 384, device_scale_factor: 1.25, is_mobile: true, has_touch: true, is_landscape: true}}, "Microsoft Lumia 550" => {name: "Microsoft Lumia 550", user_agent: "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 550) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/14.14263", viewport: {width: 640, height: 360, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: false}}, "Microsoft Lumia 950" => {name: "Microsoft Lumia 950", user_agent: "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/14.14263", viewport: {width: 360, height: 640, device_scale_factor: 4, is_mobile: true, has_touch: true, is_landscape: false}}, "Microsoft Lumia 950 landscape" => {name: "Microsoft Lumia 950 landscape", user_agent: "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/14.14263", viewport: {width: 640, height: 360, device_scale_factor: 4, is_mobile: true, has_touch: true, is_landscape: true}}, "Nexus 10" => {name: "Nexus 10", user_agent: "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Safari/537.36", viewport: {width: 800, height: 1280, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: false}}, "Nexus 10 landscape" => {name: "Nexus 10 landscape", user_agent: "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Safari/537.36", viewport: {width: 1280, height: 800, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: true}}, "Nexus 4" => {name: "Nexus 4", user_agent: "Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36", viewport: {width: 384, height: 640, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: false}}, "Nexus 4 landscape" => {name: "Nexus 4 landscape", user_agent: "Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36", viewport: {width: 640, height: 384, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: true}}, "Nexus 5" => {name: "Nexus 5", user_agent: "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36", viewport: {width: 360, height: 640, device_scale_factor: 3, is_mobile: true, has_touch: true, is_landscape: false}}, "Nexus 5 landscape" => {name: "Nexus 5 landscape", user_agent: "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36", viewport: {width: 640, height: 360, device_scale_factor: 3, is_mobile: true, has_touch: true, is_landscape: true}}, "Nexus 5X" => {name: "Nexus 5X", user_agent: "Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36", viewport: {width: 412, height: 732, device_scale_factor: 2.625, is_mobile: true, has_touch: true, is_landscape: false}}, "Nexus 5X landscape" => {name: "Nexus 5X landscape", user_agent: "Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36", viewport: {width: 732, height: 412, device_scale_factor: 2.625, is_mobile: true, has_touch: true, is_landscape: true}}, "Nexus 6" => {name: "Nexus 6", user_agent: "Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36", viewport: {width: 412, height: 732, device_scale_factor: 3.5, is_mobile: true, has_touch: true, is_landscape: false}}, "Nexus 6 landscape" => {name: "Nexus 6 landscape", user_agent: "Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36", viewport: {width: 732, height: 412, device_scale_factor: 3.5, is_mobile: true, has_touch: true, is_landscape: true}}, "Nexus 6P" => {name: "Nexus 6P", user_agent: "Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36", viewport: {width: 412, height: 732, device_scale_factor: 3.5, is_mobile: true, has_touch: true, is_landscape: false}}, "Nexus 6P landscape" => {name: "Nexus 6P landscape", user_agent: "Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36", viewport: {width: 732, height: 412, device_scale_factor: 3.5, is_mobile: true, has_touch: true, is_landscape: true}}, "Nexus 7" => {name: "Nexus 7", user_agent: "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Safari/537.36", viewport: {width: 600, height: 960, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: false}}, "Nexus 7 landscape" => {name: "Nexus 7 landscape", user_agent: "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Safari/537.36", viewport: {width: 960, height: 600, device_scale_factor: 2, is_mobile: true, has_touch: true, is_landscape: true}}, "Nokia Lumia 520" => {name: "Nokia Lumia 520", user_agent: "Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)", viewport: {width: 320, height: 533, device_scale_factor: 1.5, is_mobile: true, has_touch: true, is_landscape: false}}, "Nokia Lumia 520 landscape" => {name: "Nokia Lumia 520 landscape", user_agent: "Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)", viewport: {width: 533, height: 320, device_scale_factor: 1.5, is_mobile: true, has_touch: true, is_landscape: true}}, "Nokia N9" => {name: "Nokia N9", user_agent: "Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13", viewport: {width: 480, height: 854, device_scale_factor: 1, is_mobile: true, has_touch: true, is_landscape: false}}, "Nokia N9 landscape" => {name: "Nokia N9 landscape", user_agent: "Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13", viewport: {width: 854, height: 480, device_scale_factor: 1, is_mobile: true, has_touch: true, is_landscape: true}}, "Pixel 2" => {name: "Pixel 2", user_agent: "Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36", viewport: {width: 411, height: 731, device_scale_factor: 2.625, is_mobile: true, has_touch: true, is_landscape: false}}, "Pixel 2 landscape" => {name: "Pixel 2 landscape", user_agent: "Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36", viewport: {width: 731, height: 411, device_scale_factor: 2.625, is_mobile: true, has_touch: true, is_landscape: true}}, "Pixel 2 XL" => {name: "Pixel 2 XL", user_agent: "Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36", viewport: {width: 411, height: 823, device_scale_factor: 3.5, is_mobile: true, has_touch: true, is_landscape: false}}, "Pixel 2 XL landscape" => {name: "Pixel 2 XL landscape", user_agent: "Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36", viewport: {width: 823, height: 411, device_scale_factor: 3.5, is_mobile: true, has_touch: true, is_landscape: true}}}
ElementId = "$elementId"
ElementIdPath = "/element/" + ElementId
FirefoxCommands = BasicCommands.merge({"GetContext" => {:get, SessionIdPath + "/moz/context"}, "SetContext" => {:post, SessionIdPath + "/moz/context"}, "ElementGetAnonymousChildren" => {:post, ((SessionIdPath + "/moz/xbl/") + ElementId) + "/anonymous_children"}, "ElementFindAnonymousElementsByAttribute" => {:post, ((SessionIdPath + "/moz/xbl/") + ElementId) + "/anonymous_by_attribute"}, "InstallAddon" => {:post, SessionIdPath + "/moz/addon/install"}, "UninstallAddon" => {:post, SessionIdPath + "/moz/addon/uninstall"}, "FullPageScreenshot" => {:get, SessionIdPath + "/moz/screenshot/full"}})
NameTag = "$name"
SafariCommands = BasicCommands.merge({"GetPermissions" => {:get, SessionIdPath + "/apple/permissions"}, "SetPermissions" => {:post, SessionIdPath + "/apple/permissions"}, "AttachDebugger" => {:post, SessionIdPath + "/apple/attach_debugger"}})
SessionIdPath = "/session/$sessionId"
VERSION = "0.2.0"
WindowHandlePath = "/window/$windowHandle"

Class Method Summary

Class Method Detail

def self.device_descriptors #