Class: Selenium::WebDriver::Remote::W3CBridge Private
- Inherits:
-
Object
- Object
- Selenium::WebDriver::Remote::W3CBridge
- Includes:
- BridgeHelper
- Defined in:
- lib/selenium/webdriver/remote/w3c_bridge.rb,
lib/selenium/webdriver/remote/w3c_commands.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
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.
Direct Known Subclasses
Constant Summary collapse
- COMMANDS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{}
- QUIT_ERRORS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
[IOError]
Instance Attribute Summary collapse
- #capabilities ⇒ Object readonly private
- #context ⇒ Object private
- #file_detector ⇒ Object private
- #http ⇒ Object private
Class Method Summary collapse
-
.command(name, verb, url) ⇒ Object
private
Defines a wrapper method for a command, which ultimately calls #execute.
Instance Method Summary collapse
-
#acceptAlert ⇒ Object
private
alerts.
-
#addCookie(cookie) ⇒ Object
private
cookies.
- #browser ⇒ Object private
- #clearElement(element) ⇒ Object private
- #clearLocalStorage ⇒ Object private
- #clearSessionStorage ⇒ Object private
- #click ⇒ Object private
-
#clickElement(element) ⇒ Object
private
actions.
- #close ⇒ Object private
- #contextClick ⇒ Object private
- #create_session(desired_capabilities) ⇒ Object private
- #deleteAllCookies ⇒ Object private
- #deleteCookie(name) ⇒ Object private
- #dismissAlert ⇒ Object private
- #doubleClick ⇒ Object private
- #dragElement(element, right_by, down_by) ⇒ Object private
- #driver_extensions ⇒ Object private
- #executeAsyncScript(script, *args) ⇒ Object private
-
#executeScript(script, *args) ⇒ Object
private
javascript execution.
- #find_element_by(how, what, parent = nil) ⇒ Object private
- #find_elements_by(how, what, parent = nil) ⇒ Object private
- #fullscreenWindow ⇒ Object private
- #get(url) ⇒ Object private
-
#getActiveElement ⇒ Object
(also: #switchToActiveElement)
private
finding elements.
- #getAlertText ⇒ Object private
- #getAllCookies ⇒ Object private
-
#getCookie(name) ⇒ Object
private
TODO - write specs.
- #getCurrentUrl ⇒ Object private
- #getCurrentWindowHandle ⇒ Object private
- #getElementAttribute(element, name) ⇒ Object private
- #getElementLocation(element) ⇒ Object private
- #getElementLocationOnceScrolledIntoView(element) ⇒ Object private
- #getElementSize(element) ⇒ Object private
-
#getElementTagName(element) ⇒ Object
private
element properties.
- #getElementText(element) ⇒ Object private
- #getElementValue(element) ⇒ Object private
- #getElementValueOfCssProperty(element, prop) ⇒ Object private
-
#getLocalStorageItem(key) ⇒ Object
private
HTML 5.
- #getLocalStorageKeys ⇒ Object private
- #getLocalStorageSize ⇒ Object private
- #getLocation ⇒ Object private
- #getNetworkConnection ⇒ Object private
- #getPageSource ⇒ Object private
- #getScreenOrientation ⇒ Object private
- #getScreenshot ⇒ Object private
- #getSessionStorageItem(key) ⇒ Object private
- #getSessionStorageKeys ⇒ Object private
- #getSessionStorageSize ⇒ Object private
- #getTitle ⇒ Object private
-
#getWindowHandles ⇒ Object
private
window handling.
- #getWindowPosition(_handle = nil) ⇒ Object private
- #getWindowSize(handle = :current) ⇒ Object private
-
#goBack ⇒ Object
private
navigation.
- #goForward ⇒ Object private
-
#initialize(opts = {}) ⇒ W3CBridge
constructor
private
Initializes the bridge with the given server URL.
- #isElementDisplayed(element) ⇒ Object private
- #isElementEnabled(element) ⇒ Object private
- #isElementSelected(element) ⇒ Object private
- #maximizeWindow(handle = :current) ⇒ Object private
- #mouseDown ⇒ Object private
- #mouseMoveTo(element, x = nil, y = nil) ⇒ Object private
- #mouseUp ⇒ Object private
- #quit ⇒ Object private
- #refresh ⇒ Object private
- #removeLocalStorageItem(key) ⇒ Object private
- #removeSessionStorageItem(key) ⇒ Object private
- #sendKeysToActiveElement(keys) ⇒ Object private
-
#sendKeysToElement(element, keys) ⇒ Object
private
TODO - Implement file verification.
-
#session_id ⇒ Object
private
Returns the current session ID.
- #setAlertValue(keys) ⇒ Object private
- #setImplicitWaitTimeout(milliseconds) ⇒ Object private
- #setLocalStorageItem(key, value) ⇒ Object private
- #setLocation(_lat, _lon, _alt) ⇒ Object private
- #setNetworkConnection(_type) ⇒ Object private
- #setScreenOrientation(orientation) ⇒ Object private
- #setScriptTimeout(milliseconds) ⇒ Object private
- #setSessionStorageItem(key, value) ⇒ Object private
- #setTimeout(type, milliseconds) ⇒ Object private
- #setWindowPosition(_x, _y, _handle = nil) ⇒ Object private
- #setWindowSize(width, height, handle = :current) ⇒ Object private
- #status ⇒ Object private
- #submitElement(element) ⇒ Object private
- #switchToDefaultContent ⇒ Object private
- #switchToFrame(id) ⇒ Object private
- #switchToParentFrame ⇒ Object private
- #switchToWindow(name) ⇒ Object private
- #touchDoubleTap(element) ⇒ Object private
- #touchDown(x, y) ⇒ Object private
- #touchElementFlick(element, right_by, down_by, speed) ⇒ Object private
- #touchFlick(xspeed, yspeed) ⇒ Object private
- #touchLongPress(element) ⇒ Object private
- #touchMove(x, y) ⇒ Object private
- #touchScroll(element, x, y) ⇒ Object private
- #touchSingleTap(element) ⇒ Object private
- #touchUp(x, y) ⇒ Object private
Methods included from BridgeHelper
#element_id_from, #parse_cookie_string, #unwrap_script_result
Constructor Details
#initialize(opts = {}) ⇒ W3CBridge
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializes the bridge with the given server URL.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 64 def initialize(opts = {}) if opts.fetch(:desired_capabilities, {})[:browser_name] == 'MicrosoftEdge' require_relative '../edge/legacy_support' extend Edge::LegacySupport end opts = opts.dup http_client = opts.delete(:http_client) { Http::Default.new } desired_capabilities = opts.delete(:desired_capabilities) { W3CCapabilities.firefox } url = opts.delete(:url) { "http://#{Platform.localhost}:4444/wd/hub" } desired_capabilities = W3CCapabilities.send(desired_capabilities) if desired_capabilities.is_a? Symbol desired_capabilities[:marionette] = opts.delete(:marionette) unless opts[:marionette].nil? unless opts.empty? raise ArgumentError, "unknown option#{'s' if opts.size != 1}: #{opts.inspect}" end uri = url.kind_of?(URI) ? url : URI.parse(url) uri.path += "/" unless uri.path =~ /\/$/ http_client.server_url = uri @http = http_client @capabilities = create_session(desired_capabilities) @file_detector = nil end |
Instance Attribute Details
#capabilities ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
54 55 56 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 54 def capabilities @capabilities end |
#context ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
53 54 55 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 53 def context @context end |
#file_detector ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
53 54 55 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 53 def file_detector @file_detector end |
#http ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
53 54 55 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 53 def http @http end |
Class Method Details
.command(name, verb, url) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Defines a wrapper method for a command, which ultimately calls #execute.
49 50 51 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 49 def self.command(name, verb, url) COMMANDS[name] = [verb, url.freeze] end |
Instance Method Details
#acceptAlert ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
alerts
155 156 157 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 155 def acceptAlert execute :acceptAlert end |
#addCookie(cookie) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
cookies
368 369 370 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 368 def addCookie() execute :addCookie, {}, :cookie => end |
#browser ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
94 95 96 97 98 99 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 94 def browser @browser ||= ( name = @capabilities.browser_name name ? name.gsub(" ", "_").to_sym : 'unknown' ) end |
#clearElement(element) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
436 437 438 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 436 def clearElement(element) execute :elementClear, :id => element end |
#clearLocalStorage ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
302 303 304 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 302 def clearLocalStorage executeScript("localStorage.clear()") end |
#clearSessionStorage ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
326 327 328 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 326 def clearSessionStorage executeScript("sessionStorage.clear()") end |
#click ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
397 398 399 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 397 def click execute :click, {}, :button => 0 end |
#clickElement(element) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
actions
393 394 395 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 393 def clickElement(element) execute :elementClick, :id => element end |
#close ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
222 223 224 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 222 def close execute :closeWindow end |
#contextClick ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
405 406 407 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 405 def contextClick execute :click, {}, :button => 2 end |
#create_session(desired_capabilities) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
122 123 124 125 126 127 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 122 def create_session(desired_capabilities) resp = raw_execute :newSession, {}, :desiredCapabilities => desired_capabilities @session_id = resp['sessionId'] or raise Error::WebDriverError, 'no sessionId in returned payload' W3CCapabilities.json_create resp['value'] end |
#deleteAllCookies ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
385 386 387 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 385 def deleteAllCookies getAllCookies.each { || deleteCookie(['name'])} end |
#deleteCookie(name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
372 373 374 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 372 def deleteCookie(name) execute :deleteCookie, :name => name end |
#dismissAlert ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
159 160 161 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 159 def dismissAlert execute :dismissAlert end |
#doubleClick ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
401 402 403 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 401 def doubleClick execute :doubleClick end |
#dragElement(element, right_by, down_by) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
446 447 448 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 446 def dragElement(element, right_by, down_by) execute :dragElement, {:id => element}, :x => right_by, :y => down_by end |
#driver_extensions ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 101 def driver_extensions [ DriverExtensions::HasInputDevices, DriverExtensions::UploadsFiles, DriverExtensions::TakesScreenshot, DriverExtensions::HasSessionId, DriverExtensions::Rotatable, DriverExtensions::HasTouchScreen, DriverExtensions::HasRemoteStatus, DriverExtensions::HasWebStorage ] end |
#executeAsyncScript(script, *args) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
359 360 361 362 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 359 def executeAsyncScript(script, *args) result = execute :executeAsyncScript, {}, :script => script, :args => args unwrap_script_result result end |
#executeScript(script, *args) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
javascript execution
354 355 356 357 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 354 def executeScript(script, *args) result = execute :executeScript, {}, :script => script, :args => args unwrap_script_result result end |
#find_element_by(how, what, parent = nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
568 569 570 571 572 573 574 575 576 577 578 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 568 def find_element_by(how, what, parent = nil) how, what = convert_locators(how, what) if parent id = execute :findChildElement, {:id => parent}, {:using => how, :value => what} else id = execute :findElement, {}, {:using => how, :value => what} end Element.new self, element_id_from(id) end |
#find_elements_by(how, what, parent = nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
580 581 582 583 584 585 586 587 588 589 590 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 580 def find_elements_by(how, what, parent = nil) how, what = convert_locators(how, what) if parent ids = execute :findChildElements, {:id => parent}, {:using => how, :value => what} else ids = execute :findElements, {}, {:using => how, :value => what} end ids.map { |id| Element.new self, element_id_from(id) } end |
#fullscreenWindow ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
257 258 259 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 257 def fullscreenWindow execute :fullscreenWindow end |
#get(url) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
135 136 137 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 135 def get(url) execute :get, {}, :url => url end |
#getActiveElement ⇒ Object Also known as: switchToActiveElement
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
finding elements
563 564 565 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 563 def getActiveElement Element.new self, element_id_from(execute(:getActiveElement)) end |
#getAlertText ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
167 168 169 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 167 def getAlertText execute :getAlertText end |
#getAllCookies ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
381 382 383 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 381 def getAllCookies execute :getAllCookies end |
#getCookie(name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
TODO - write specs
377 378 379 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 377 def getCookie(name) execute :getCookie, :name => name end |
#getCurrentUrl ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
183 184 185 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 183 def getCurrentUrl execute :getCurrentUrl end |
#getCurrentWindowHandle ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
238 239 240 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 238 def getCurrentWindowHandle execute :getWindowHandle end |
#getElementAttribute(element, name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
512 513 514 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 512 def getElementAttribute(element, name) execute :getElementAttribute, :id => element, :name => name end |
#getElementLocation(element) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
524 525 526 527 528 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 524 def getElementLocation(element) data = execute :getElementRect, :id => element Point.new data['x'], data['y'] end |
#getElementLocationOnceScrolledIntoView(element) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
530 531 532 533 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 530 def getElementLocationOnceScrolledIntoView(element) sendKeysToElement(element, ['']) getElementLocation(element) end |
#getElementSize(element) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
535 536 537 538 539 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 535 def getElementSize(element) data = execute :getElementRect, :id => element Dimension.new data['width'], data['height'] end |
#getElementTagName(element) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
element properties
508 509 510 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 508 def getElementTagName(element) execute :getElementTagName, :id => element end |
#getElementText(element) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
520 521 522 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 520 def getElementText(element) execute :getElementText, :id => element end |
#getElementValue(element) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
516 517 518 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 516 def getElementValue(element) execute :getElementProperty, :id => element, :name => 'value' end |
#getElementValueOfCssProperty(element, prop) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
555 556 557 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 555 def getElementValueOfCssProperty(element, prop) execute :getElementCssValue, :id => element, :property_name => prop end |
#getLocalStorageItem(key) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
HTML 5
286 287 288 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 286 def getLocalStorageItem(key) executeScript("return localStorage.getItem('#{key}')") end |
#getLocalStorageKeys ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
294 295 296 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 294 def getLocalStorageKeys executeScript("return Object.keys(localStorage)") end |
#getLocalStorageSize ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
306 307 308 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 306 def getLocalStorageSize executeScript("return localStorage.length") end |
#getLocation ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
334 335 336 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 334 def getLocation raise Error::UnsupportedOperationError, 'The W3C standard does not currently support getting location' end |
#getNetworkConnection ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
342 343 344 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 342 def getNetworkConnection raise Error::UnsupportedOperationError, 'The W3C standard does not currently support getting network connection' end |
#getPageSource ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
191 192 193 194 195 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 191 def getPageSource executeScript("var source = document.documentElement.outerHTML;" + "if (!source) { source = new XMLSerializer().serializeToString(document); }" + "return source;") end |
#getScreenOrientation ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
500 501 502 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 500 def getScreenOrientation execute :getScreenOrientation end |
#getScreenshot ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
278 279 280 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 278 def getScreenshot execute :takeScreenshot end |
#getSessionStorageItem(key) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
310 311 312 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 310 def getSessionStorageItem(key) executeScript("return sessionStorage.getItem('#{key}')") end |
#getSessionStorageKeys ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
318 319 320 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 318 def getSessionStorageKeys executeScript("return Object.keys(sessionStorage)") end |
#getSessionStorageSize ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
330 331 332 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 330 def getSessionStorageSize executeScript("return sessionStorage.length") end |
#getTitle ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
187 188 189 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 187 def getTitle execute :getTitle end |
#getWindowHandles ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
window handling
234 235 236 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 234 def getWindowHandles execute :getWindowHandles end |
#getWindowPosition(_handle = nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
274 275 276 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 274 def getWindowPosition(_handle = nil) raise Error::UnsupportedOperationError, 'The W3C standard does not currently support getting the Window Position' end |
#getWindowSize(handle = :current) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
261 262 263 264 265 266 267 268 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 261 def getWindowSize(handle = :current) unless handle == :current raise Error::UnsupportedOperationError, 'Switch to desired window before getting its size' end data = execute :getWindowSize Dimension.new data['width'], data['height'] end |
#goBack ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
navigation
175 176 177 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 175 def goBack execute :back end |
#goForward ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
179 180 181 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 179 def goForward execute :forward end |
#isElementDisplayed(element) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
549 550 551 552 553 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 549 def isElementDisplayed(element) jwp = Selenium::WebDriver::Remote::Bridge::COMMANDS[:isElementDisplayed] self.class.command(:isElementDisplayed, jwp.first, jwp.last) execute :isElementDisplayed, :id => element end |
#isElementEnabled(element) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
541 542 543 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 541 def isElementEnabled(element) execute :isElementEnabled, :id => element end |
#isElementSelected(element) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
545 546 547 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 545 def isElementSelected(element) execute :isElementSelected, :id => element end |
#maximizeWindow(handle = :current) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
250 251 252 253 254 255 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 250 def maximizeWindow(handle = :current) unless handle == :current raise Error::UnsupportedOperationError, 'Switch to desired window before changing its size' end execute :maximizeWindow end |
#mouseDown ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
409 410 411 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 409 def mouseDown execute :mouseDown end |
#mouseMoveTo(element, x = nil, y = nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
417 418 419 420 421 422 423 424 425 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 417 def mouseMoveTo(element, x = nil, y = nil) params = { :element => element } if x && y params.merge! :xoffset => x, :yoffset => y end execute :mouseMoveTo, {}, params end |
#mouseUp ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
413 414 415 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 413 def mouseUp execute :mouseUp end |
#quit ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
216 217 218 219 220 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 216 def quit execute :deleteSession http.close rescue *QUIT_ERRORS end |
#refresh ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
226 227 228 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 226 def refresh execute :refresh end |
#removeLocalStorageItem(key) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
290 291 292 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 290 def removeLocalStorageItem(key) executeScript("localStorage.removeItem('#{key}')") end |
#removeSessionStorageItem(key) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
314 315 316 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 314 def removeSessionStorageItem(key) executeScript("sessionStorage.removeItem('#{key}')") end |
#sendKeysToActiveElement(keys) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
427 428 429 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 427 def sendKeysToActiveElement(keys) sendKeysToElement(getActiveElement, keys) end |
#sendKeysToElement(element, keys) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
TODO - Implement file verification
432 433 434 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 432 def sendKeysToElement(element, keys) execute :elementSendKeys, {:id => element}, {:value => keys.join('').split(//)} end |
#session_id ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the current session ID.
118 119 120 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 118 def session_id @session_id || raise(Error::WebDriverError, "no current session exists") end |
#setAlertValue(keys) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
163 164 165 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 163 def setAlertValue(keys) execute :sendAlertText, {}, {:handler => 'prompt', :message => keys} end |
#setImplicitWaitTimeout(milliseconds) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
139 140 141 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 139 def setImplicitWaitTimeout(milliseconds) setTimeout('implicit', milliseconds) end |
#setLocalStorageItem(key, value) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
298 299 300 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 298 def setLocalStorageItem(key, value) executeScript("localStorage.setItem('#{key}', '#{value}')") end |
#setLocation(_lat, _lon, _alt) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
338 339 340 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 338 def setLocation(_lat, _lon, _alt) raise Error::UnsupportedOperationError, 'The W3C standard does not currently support setting location' end |
#setNetworkConnection(_type) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
346 347 348 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 346 def setNetworkConnection(_type) raise Error::UnsupportedOperationError, 'The W3C standard does not currently support setting network connection' end |
#setScreenOrientation(orientation) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
496 497 498 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 496 def setScreenOrientation(orientation) execute :setScreenOrientation, {}, :orientation => orientation end |
#setScriptTimeout(milliseconds) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
143 144 145 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 143 def setScriptTimeout(milliseconds) setTimeout('script', milliseconds) end |
#setSessionStorageItem(key, value) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
322 323 324 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 322 def setSessionStorageItem(key, value) executeScript("sessionStorage.setItem('#{key}', '#{value}')") end |
#setTimeout(type, milliseconds) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
147 148 149 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 147 def setTimeout(type, milliseconds) execute :setTimeout, {}, :type => type, :ms => milliseconds end |
#setWindowPosition(_x, _y, _handle = nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
270 271 272 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 270 def setWindowPosition(_x, _y, _handle = nil) raise Error::UnsupportedOperationError, 'The W3C standard does not currently support setting the Window Position' end |
#setWindowSize(width, height, handle = :current) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
242 243 244 245 246 247 248 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 242 def setWindowSize(width, height, handle = :current) unless handle == :current raise Error::WebDriverError, 'Switch to desired window before changing its size' end execute :setWindowSize, {}, {:width => width, :height => height} end |
#status ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
129 130 131 132 133 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 129 def status jwp = Selenium::WebDriver::Remote::Bridge::COMMANDS[:status] self.class.command(:status, jwp.first, jwp.last) execute :status end |
#submitElement(element) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
440 441 442 443 444 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 440 def submitElement(element) executeScript("var e = arguments[0].ownerDocument.createEvent('Event');" + "e.initEvent('submit', true, true);" + "if (arguments[0].dispatchEvent(e)) { arguments[0].submit() }", element) end |
#switchToDefaultContent ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
210 211 212 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 210 def switchToDefaultContent switchToFrame nil end |
#switchToFrame(id) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
201 202 203 204 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 201 def switchToFrame(id) id = find_element_by('id', id) if id.is_a? String execute :switchToFrame, {}, :id => id end |
#switchToParentFrame ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
206 207 208 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 206 def switchToParentFrame execute :switchToParentFrame end |
#switchToWindow(name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
197 198 199 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 197 def switchToWindow(name) execute :switchToWindow, {}, :handle => name end |
#touchDoubleTap(element) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
454 455 456 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 454 def touchDoubleTap(element) execute :touchDoubleTap, {}, :element => element end |
#touchDown(x, y) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
462 463 464 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 462 def touchDown(x, y) execute :touchDown, {}, :x => x, :y => y end |
#touchElementFlick(element, right_by, down_by, speed) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
488 489 490 491 492 493 494 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 488 def touchElementFlick(element, right_by, down_by, speed) execute :touchFlick, {}, :element => element, :xoffset => right_by, :yoffset => down_by, :speed => speed end |
#touchFlick(xspeed, yspeed) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
484 485 486 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 484 def touchFlick(xspeed, yspeed) execute :touchFlick, {}, :xspeed => xspeed, :yspeed => yspeed end |
#touchLongPress(element) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
458 459 460 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 458 def touchLongPress(element) execute :touchLongPress, {}, :element => element end |
#touchMove(x, y) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
470 471 472 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 470 def touchMove(x, y) execute :touchMove, {}, :x => x, :y => y end |
#touchScroll(element, x, y) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
474 475 476 477 478 479 480 481 482 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 474 def touchScroll(element, x, y) if element execute :touchScroll, {}, :element => element, :xoffset => x, :yoffset => y else execute :touchScroll, {}, :xoffset => x, :yoffset => y end end |
#touchSingleTap(element) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
450 451 452 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 450 def touchSingleTap(element) execute :touchSingleTap, {}, :element => element end |
#touchUp(x, y) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
466 467 468 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 466 def touchUp(x, y) execute :touchUp, {}, :x => x, :y => y end |