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
-
#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
- #elementEquals(element, other) ⇒ 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
- #get(url) ⇒ Object private
-
#getActiveElement ⇒ Object
(also: #switchToActiveElement)
private
finding elements.
-
#getAlert ⇒ Object
private
alerts.
- #getAlertText ⇒ Object private
- #getAllCookies ⇒ Object private
- #getCapabilities ⇒ 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
- #getVisible ⇒ Object private
-
#getWindowHandles ⇒ Object
private
window handling.
- #getWindowPosition(handle = :current) ⇒ 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
-
#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
- #setVisible(bool) ⇒ Object private
- #setWindowPosition(x, y, handle = :current) ⇒ Object private
-
#setWindowSize(width, height, handle = :current) ⇒ Object
private
TODO - These Commands might require checking for being current window before performing.
- #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
- #upload(local_file) ⇒ 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.
62 63 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 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 62 def initialize(opts = {}) 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" } unless opts.empty? raise ArgumentError, "unknown option#{'s' if opts.size != 1}: #{opts.inspect}" end if desired_capabilities.kind_of?(Symbol) unless W3CCapabilities.respond_to?(desired_capabilities) raise Error::WebDriverError, "invalid desired capability: #{desired_capabilities.inspect}" end desired_capabilities = W3CCapabilities.send(desired_capabilities) 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.
52 53 54 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 52 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.
51 52 53 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 51 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.
51 52 53 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 51 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.
51 52 53 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 51 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.
47 48 49 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 47 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.
160 161 162 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 160 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
380 381 382 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 380 def addCookie() execute :addCookie, {}, 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.
92 93 94 95 96 97 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 92 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.
455 456 457 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 455 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.
312 313 314 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 312 def clearLocalStorage execute :clearLocalStorage 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.
336 337 338 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 336 def clearSessionStorage execute :clearSessionStorage 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.
409 410 411 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 409 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
405 406 407 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 405 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.
241 242 243 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 241 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.
417 418 419 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 417 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.
121 122 123 124 125 126 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 121 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.
397 398 399 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 397 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.
384 385 386 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 384 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.
164 165 166 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 164 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.
413 414 415 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 413 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.
466 467 468 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 466 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.
99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 99 def driver_extensions [ DriverExtensions::HasInputDevices, DriverExtensions::UploadsFiles, DriverExtensions::TakesScreenshot, DriverExtensions::HasSessionId, DriverExtensions::Rotatable, DriverExtensions::HasTouchScreen, DriverExtensions::HasLocation, DriverExtensions::HasNetworkConnection, DriverExtensions::HasRemoteStatus ] end |
#elementEquals(element, other) ⇒ 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.
577 578 579 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 577 def elementEquals(element, other) element.ref == other.ref 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.
371 372 373 374 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 371 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
366 367 368 369 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 366 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.
590 591 592 593 594 595 596 597 598 599 600 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 590 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.
602 603 604 605 606 607 608 609 610 611 612 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 602 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 |
#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.
132 133 134 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 132 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
585 586 587 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 585 def getActiveElement Element.new self, element_id_from(execute(:getActiveElement)) end |
#getAlert ⇒ 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
156 157 158 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 156 def getAlert execute :getAlert 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.
172 173 174 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 172 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.
393 394 395 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 393 def getAllCookies execute :getAllCookies end |
#getCapabilities ⇒ 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.
136 137 138 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 136 def getCapabilities W3CCapabilities.json_create execute(:getCapabilities) 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
389 390 391 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 389 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.
188 189 190 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 188 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.
257 258 259 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 257 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.
532 533 534 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 532 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.
544 545 546 547 548 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 544 def getElementLocation(element) data = execute :getElementLocation, :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.
550 551 552 553 554 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 550 def getElementLocationOnceScrolledIntoView(element) data = execute :getElementLocationOnceScrolledIntoView, :id => element Point.new data['x'], data['y'] 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.
556 557 558 559 560 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 556 def getElementSize(element) data = execute :getElementSize, :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
528 529 530 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 528 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.
540 541 542 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 540 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.
536 537 538 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 536 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.
573 574 575 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 573 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
296 297 298 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 296 def getLocalStorageItem(key) execute :getLocalStorageItem, :key => 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.
304 305 306 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 304 def getLocalStorageKeys execute :getLocalStorageKeys 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.
316 317 318 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 316 def getLocalStorageSize execute :getLocalStorageSize 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.
344 345 346 347 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 344 def getLocation obj = execute(:getLocation) || {} # android returns null Location.new obj['latitude'], obj['longitude'], obj['altitude'] 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.
354 355 356 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 354 def getNetworkConnection execute :getNetworkConnection 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.
196 197 198 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 196 def getPageSource execute :getPageSource 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.
520 521 522 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 520 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.
288 289 290 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 288 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.
320 321 322 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 320 def getSessionStorageItem(key) execute :getSessionStorageItem, :key => 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.
328 329 330 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 328 def getSessionStorageKeys execute :getSessionStorageKeys 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.
340 341 342 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 340 def getSessionStorageSize execute :getSessionStorageSize 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.
192 193 194 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 192 def getTitle execute :getTitle end |
#getVisible ⇒ 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.
200 201 202 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 200 def getVisible execute :getVisible 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
253 254 255 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 253 def getWindowHandles execute :getWindowHandles end |
#getWindowPosition(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.
282 283 284 285 286 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 282 def getWindowPosition(handle = :current) data = execute :getWindowPosition Point.new data['x'], data['y'] 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.
272 273 274 275 276 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 272 def getWindowSize(handle = :current) 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
180 181 182 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 180 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.
184 185 186 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 184 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.
570 571 572 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 570 def isElementDisplayed(element) 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.
562 563 564 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 562 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.
566 567 568 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 566 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.
268 269 270 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 268 def maximizeWindow(handle = :current) 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.
421 422 423 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 421 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.
429 430 431 432 433 434 435 436 437 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 429 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.
425 426 427 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 425 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.
235 236 237 238 239 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 235 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.
245 246 247 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 245 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.
300 301 302 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 300 def removeLocalStorageItem(key) execute :removeLocalStorageItem, :key => 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.
324 325 326 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 324 def removeSessionStorageItem(key) execute :removeSessionStorageItem, :key => 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.
439 440 441 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 439 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.
443 444 445 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 443 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.
117 118 119 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 117 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.
168 169 170 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 168 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.
140 141 142 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 140 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.
308 309 310 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 308 def setLocalStorageItem(key, value) execute :setLocalStorageItem, {}, :key => key, :value => 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.
349 350 351 352 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 349 def setLocation(lat, lon, alt) loc = {:latitude => lat, :longitude => lon, :altitude => alt} execute :setLocation, {}, :location => loc 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.
358 359 360 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 358 def setNetworkConnection(type) execute :setNetworkConnection, {}, :parameters => {:type => type} 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.
516 517 518 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 516 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.
144 145 146 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 144 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.
332 333 334 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 332 def setSessionStorageItem(key, value) execute :setSessionStorageItem, {}, :key => key, :value => 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.
148 149 150 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 148 def setTimeout(type, milliseconds) execute :setTimeout, {}, :type => type, :ms => milliseconds end |
#setVisible(bool) ⇒ 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.
204 205 206 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 204 def setVisible(bool) execute :setVisible, {}, bool end |
#setWindowPosition(x, y, 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.
278 279 280 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 278 def setWindowPosition(x, y, handle = :current) execute :setWindowPosition, :x => x, :y => y 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.
TODO - These Commands might require checking for being current window before performing
263 264 265 266 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 263 def setWindowSize(width, height, handle = :current) 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.
128 129 130 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 128 def status 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.
460 461 462 463 464 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 460 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.
229 230 231 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 229 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.
212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 212 def switchToFrame(id) locator = case id when String find_element_by('id', id) when Hash find_element_by(id.keys.first.to_s, id.values.first) else id end execute :switchToFrame, {}, :id => locator 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.
225 226 227 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 225 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.
208 209 210 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 208 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.
474 475 476 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 474 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.
482 483 484 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 482 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.
508 509 510 511 512 513 514 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 508 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.
504 505 506 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 504 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.
478 479 480 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 478 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.
490 491 492 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 490 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.
494 495 496 497 498 499 500 501 502 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 494 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.
470 471 472 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 470 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.
486 487 488 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 486 def touchUp(x, y) execute :touchUp, {}, :x => x, :y => y end |
#upload(local_file) ⇒ 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.
447 448 449 450 451 452 453 |
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 447 def upload(local_file) unless File.file?(local_file) raise Error::WebDriverError, "you may only upload files: #{local_file.inspect}" end execute :uploadFile, {}, :file => Zipper.zip_file(local_file) end |