How to use attribute method of Selenium.WebDriver Package

Best Selenium code snippet using Selenium.WebDriver.attribute

selenium-webdriver@4.1.0.rbi

Source:selenium-webdriver@4.1.0.rbi Github

copy

Full Screen

...70 # @return [Interactions::PointerInput] The pointer input added71 def add_pointer_input(kind, name); end72 # Clears all actions from the builder.73 def clear_all_actions; end74 # Returns the value of attribute devices.75 def devices; end76 # Retrieves the input device for the given name77 #78 # @param name [String] name of the input device79 # @return [Selenium::WebDriver::Interactions::InputDevice] input device with given name80 def get_device(name); end81 # Retrieves the current KeyInput device82 #83 # @return [Selenium::WebDriver::Interactions::InputDevice] current KeyInput device84 def key_inputs; end85 # Creates a pause for the given device of the given duration. If no duration is given, the pause will only wait86 # for all actions to complete in that tick.87 #88 # @example Send keys to an element89 #90 # action_builder = driver.action91 # keyboard = action_builder.key_input92 # el = driver.find_element(id: "some_id")93 # driver.action.click(el).pause(keyboard).pause(keyboard).pause(keyboard).send_keys('keys').perform94 # @param device [InputDevice] Input device to pause95 # @param duration [Float] Duration to pause96 # @return [ActionBuilder] A self reference.97 def pause(device, duration = T.unsafe(nil)); end98 # Creates multiple pauses for the given device of the given duration.99 #100 # @example Send keys to an element101 #102 # action_builder = driver.action103 # keyboard = action_builder.key_input104 # el = driver.find_element(id: "some_id")105 # driver.action.click(el).pauses(keyboard, 3).send_keys('keys').perform106 # @param device [InputDevice] Input device to pause107 # @param number [Integer] of pauses to add for the device108 # @param duration [Float] Duration to pause109 # @return [ActionBuilder] A self reference.110 def pauses(device, number, duration = T.unsafe(nil)); end111 # Executes the actions added to the builder.112 def perform; end113 # Retrieves the current PointerInput devices114 #115 # @return [Array] array of current PointerInput devices116 def pointer_inputs; end117 # Releases all action states from the browser.118 def release_actions; end119 private120 # Adds an InputDevice121 def add_input(device); end122 # Adds pauses for all devices but the given devices123 #124 # @param action_devices [Array[InputDevice]] Array of Input Devices performing an action in this tick.125 def tick(*action_devices); end126end127class Selenium::WebDriver::Alert128 # @return [Alert] a new instance of Alert129 def initialize(bridge); end130 def accept; end131 def dismiss; end132 def send_keys(keys); end133 def text; end134end135module Selenium::WebDriver::Atoms136 private137 def execute_atom(function_name, *arguments); end138 def read_atom(function); end139end140module Selenium::WebDriver::Chrome141 class << self142 def driver_path; end143 def driver_path=(path); end144 def path; end145 def path=(path); end146 end147end148# Driver implementation for Chrome.149#150# @api private151class Selenium::WebDriver::Chrome::Driver < ::Selenium::WebDriver::Driver152 # @api private153 def browser; end154 private155 # @api private156 def devtools_address; end157 # @api private158 def devtools_url; end159 # @api private160 def devtools_version; end161end162# @api private163Selenium::WebDriver::Chrome::Driver::EXTENSIONS = T.let(T.unsafe(nil), Array)164module Selenium::WebDriver::Chrome::Features165 def available_log_types; end166 def cast_issue_message; end167 def cast_sink_to_use=(name); end168 def cast_sinks; end169 def commands(command); end170 def delete_network_conditions; end171 def launch_app(id); end172 def log(type); end173 def network_conditions; end174 def network_conditions=(conditions); end175 def send_command(command_params); end176 def set_permission(name, value); end177 def start_cast_tab_mirroring(name); end178 def stop_casting(name); end179end180Selenium::WebDriver::Chrome::Features::CHROME_COMMANDS = T.let(T.unsafe(nil), Hash)181class Selenium::WebDriver::Chrome::Options < ::Selenium::WebDriver::Options182 # Create a new Options instance.183 #184 # @example185 # options = Selenium::WebDriver::Chrome::Options.new(args: ['start-maximized', 'user-data-dir=/tmp/temp_profile'])186 # driver = Selenium::WebDriver.for(:chrome, capabilities: options)187 # @option opts188 # @option opts189 # @option opts190 # @option opts191 # @option opts192 # @option opts193 # @option opts194 # @option opts195 # @option opts196 # @option opts197 # @option opts198 # @option opts199 # @option opts200 # @param :profile [Profile] An instance of a Chrome::Profile Class201 # @param :encoded_extensions [Array] List of extensions that do not need to be Base64 encoded202 # @param opts [Hash] the pre-defined options to create the Chrome::Options with203 # @return [Options] a new instance of Options204 def initialize(profile: T.unsafe(nil), **opts); end205 # Add a command-line argument to use when starting Chrome.206 #207 # @example Start Chrome maximized208 # options = Selenium::WebDriver::Chrome::Options.new209 # options.add_argument('start-maximized')210 # @param arg [String] The command-line argument to add211 def add_argument(arg); end212 # Add emulation device information213 #214 # see: http://chromedriver.chromium.org/mobile-emulation215 #216 # @example Start Chrome in mobile emulation mode by device name217 # options = Selenium::WebDriver::Chrome::Options.new218 # options.add_emulation(device_name: 'iPhone 6')219 # @example Start Chrome in mobile emulation mode by device metrics220 # options = Selenium::WebDriver::Chrome::Options.new221 # options.add_emulation(device_metrics: {width: 400, height: 800, pixelRatio: 1, touch: true})222 # @option opts223 # @option opts224 # @option opts225 # @param opts [Hash] the pre-defined options for adding mobile emulation values226 def add_emulation(**opts); end227 # Add an extension by Base64-encoded string.228 #229 # @example230 # options = Selenium::WebDriver::Chrome::Options.new231 # options.add_encoded_extension(encoded_string)232 # @param encoded [String] The Base64-encoded string of the .crx file233 def add_encoded_extension(encoded); end234 # Add an extension by local path.235 #236 # @example237 # options = Selenium::WebDriver::Chrome::Options.new238 # options.add_extension('/path/to/extension.crx')239 # @param path [String] The local path to the .crx file240 def add_extension(path); end241 # Add a preference that is only applied to the user profile in use.242 #243 # @example Set the default homepage244 # options = Selenium::WebDriver::Chrome::Options.new245 # options.add_preference('homepage', 'http://www.seleniumhq.com/')246 # @param name [String] Key of the preference247 # @param value [Boolean, String, Integer] Value of the preference248 def add_preference(name, value); end249 # Enables mobile browser use on Android.250 #251 # @param package [String] The package name of the Chrome or WebView app.252 # @param serial_number [String] The device serial number on which to launch the Chrome or WebView app.253 # @param use_running_app [String] When true uses an already-running Chrome or WebView app,254 # instead of launching the app with a clear data directory.255 # @param activity [String] Name of the Activity hosting the WebView (Not available on Chrome Apps).256 # @see https://chromedriver.chromium.org/getting-started/getting-started---android257 def enable_android(package: T.unsafe(nil), serial_number: T.unsafe(nil), use_running_app: T.unsafe(nil), activity: T.unsafe(nil)); end258 # NOTE: special handling of 'extensions' to validate when set instead of when used259 def extensions; end260 # Add an extension by local path.261 #262 # @example263 # extensions = ['/path/to/extension.crx', '/path/to/other.crx']264 # options = Selenium::WebDriver::Chrome::Options.new265 # options.extensions = extensions266 # @param :extensions [Array<String>] A list of paths to (.crx) Chrome extensions to install on startup267 def extensions=(extensions); end268 # Run Chrome in headless mode.269 #270 # @example Enable headless mode271 # options = Selenium::WebDriver::Chrome::Options.new272 # options.headless!273 def headless!; end274 # Returns the value of attribute logging_prefs.275 def logging_prefs; end276 # Sets the attribute logging_prefs277 #278 # @param value the value to set the attribute logging_prefs to.279 def logging_prefs=(_arg0); end280 # Returns the value of attribute profile.281 def profile; end282 # Sets the attribute profile283 #284 # @param value the value to set the attribute profile to.285 def profile=(_arg0); end286 private287 def binary_path; end288 # @return [Boolean]289 def camelize?(key); end290 def enable_logging(browser_options); end291 def encode_extension(path); end292 def process_browser_options(browser_options); end293 # @raise [Error::WebDriverError]294 def validate_extension(path); end295end296Selenium::WebDriver::Chrome::Options::BROWSER = T.let(T.unsafe(nil), String)297# see: http://chromedriver.chromium.org/capabilities298Selenium::WebDriver::Chrome::Options::CAPABILITIES = T.let(T.unsafe(nil), Hash)299Selenium::WebDriver::Chrome::Options::KEY = T.let(T.unsafe(nil), String)300# @private301class Selenium::WebDriver::Chrome::Profile302 include ::Selenium::WebDriver::ProfileHelper303 extend ::Selenium::WebDriver::ProfileHelper::ClassMethods304 # @return [Profile] a new instance of Profile305 def initialize(model = T.unsafe(nil)); end306 def [](key); end307 # Set a preference in the profile.308 #309 # See https://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/pref_names.cc310 def []=(key, value); end311 def add_encoded_extension(encoded); end312 # @raise [Error::WebDriverError]313 def add_extension(path); end314 def as_json(*_arg0); end315 def directory; end316 def layout_on_disk; end317 private318 def prefs; end319 def prefs_file_for(dir); end320 def read_model_prefs; end321 def write_prefs_to(dir); end322end323class Selenium::WebDriver::Chrome::Service < ::Selenium::WebDriver::Service324 private325 # NOTE: This processing is deprecated326 def extract_service_args(driver_opts); end327end328Selenium::WebDriver::Chrome::Service::DEFAULT_PORT = T.let(T.unsafe(nil), Integer)329Selenium::WebDriver::Chrome::Service::EXECUTABLE = T.let(T.unsafe(nil), String)330Selenium::WebDriver::Chrome::Service::MISSING_TEXT = T.let(T.unsafe(nil), String)331Selenium::WebDriver::Chrome::Service::SHUTDOWN_SUPPORTED = T.let(T.unsafe(nil), TrueClass)332class Selenium::WebDriver::DevTools333 # @return [DevTools] a new instance of DevTools334 def initialize(url:); end335 def callbacks; end336 def close; end337 def method_missing(method, *_args); end338 # @raise [Error::WebDriverError]339 def send_cmd(method, **params); end340 private341 def attach_socket_listener; end342 def callback_thread(params); end343 def error_message(error); end344 def incoming_frame; end345 def next_id; end346 def process_frame(frame); end347 def process_handshake; end348 # @return [Boolean]349 def respond_to_missing?(method, *_args); end350 def socket; end351 def start_session; end352 def wait; end353 def ws; end354end355class Selenium::WebDriver::DevTools::ConsoleEvent356 # @return [ConsoleEvent] a new instance of ConsoleEvent357 def initialize(type:, timestamp:, args:); end358 # Returns the value of attribute args.359 def args; end360 # Sets the attribute args361 #362 # @param value the value to set the attribute args to.363 def args=(_arg0); end364 # Returns the value of attribute timestamp.365 def timestamp; end366 # Sets the attribute timestamp367 #368 # @param value the value to set the attribute timestamp to.369 def timestamp=(_arg0); end370 # Returns the value of attribute type.371 def type; end372 # Sets the attribute type373 #374 # @param value the value to set the attribute type to.375 def type=(_arg0); end376end377class Selenium::WebDriver::DevTools::ExceptionEvent378 # @return [ExceptionEvent] a new instance of ExceptionEvent379 def initialize(description:, timestamp:, stacktrace:); end380 # Returns the value of attribute description.381 def description; end382 # Sets the attribute description383 #384 # @param value the value to set the attribute description to.385 def description=(_arg0); end386 # Returns the value of attribute stacktrace.387 def stacktrace; end388 # Sets the attribute stacktrace389 #390 # @param value the value to set the attribute stacktrace to.391 def stacktrace=(_arg0); end392 # Returns the value of attribute timestamp.393 def timestamp; end394 # Sets the attribute timestamp395 #396 # @param value the value to set the attribute timestamp to.397 def timestamp=(_arg0); end398end399class Selenium::WebDriver::DevTools::MutationEvent400 # @return [MutationEvent] a new instance of MutationEvent401 def initialize(element:, attribute_name:, current_value:, old_value:); end402 # Returns the value of attribute attribute_name.403 def attribute_name; end404 # Sets the attribute attribute_name405 #406 # @param value the value to set the attribute attribute_name to.407 def attribute_name=(_arg0); end408 # Returns the value of attribute current_value.409 def current_value; end410 # Sets the attribute current_value411 #412 # @param value the value to set the attribute current_value to.413 def current_value=(_arg0); end414 # Returns the value of attribute element.415 def element; end416 # Sets the attribute element417 #418 # @param value the value to set the attribute element to.419 def element=(_arg0); end420 # Returns the value of attribute old_value.421 def old_value; end422 # Sets the attribute old_value423 #424 # @param value the value to set the attribute old_value to.425 def old_value=(_arg0); end426end427class Selenium::WebDriver::DevTools::PinnedScript428 # @return [PinnedScript] a new instance of PinnedScript429 def initialize(script); end430 # @api private431 def callable; end432 # Returns the value of attribute devtools_identifier.433 def devtools_identifier; end434 # Sets the attribute devtools_identifier435 #436 # @param value the value to set the attribute devtools_identifier to.437 def devtools_identifier=(_arg0); end438 # Returns the value of attribute key.439 def key; end440 # Sets the attribute key441 #442 # @param value the value to set the attribute key to.443 def key=(_arg0); end444 # @api private445 def remove; end446 # Returns the value of attribute script.447 def script; end448 # Sets the attribute script449 #450 # @param value the value to set the attribute script to.451 def script=(_arg0); end452 # @api private453 def to_json(*_arg0); end454end455Selenium::WebDriver::DevTools::RESPONSE_WAIT_INTERVAL = T.let(T.unsafe(nil), Float)456Selenium::WebDriver::DevTools::RESPONSE_WAIT_TIMEOUT = T.let(T.unsafe(nil), Integer)457class Selenium::WebDriver::DevTools::Request458 # @return [Request] a new instance of Request459 def initialize(id:, url:, method:, headers:, post_data:); end460 def ==(other); end461 # Returns the value of attribute headers.462 def headers; end463 # Sets the attribute headers464 #465 # @param value the value to set the attribute headers to.466 def headers=(_arg0); end467 # Returns the value of attribute id.468 def id; end469 def inspect; end470 # Returns the value of attribute method.471 def method; end472 # Sets the attribute method473 #474 # @param value the value to set the attribute method to.475 def method=(_arg0); end476 # Returns the value of attribute post_data.477 def post_data; end478 # Sets the attribute post_data479 #480 # @param value the value to set the attribute post_data to.481 def post_data=(_arg0); end482 # Returns the value of attribute url.483 def url; end484 # Sets the attribute url485 #486 # @param value the value to set the attribute url to.487 def url=(_arg0); end488 class << self489 # Creates request from DevTools message.490 #491 # @api private492 def from(id, params); end493 end494end495class Selenium::WebDriver::DevTools::Response496 # @return [Response] a new instance of Response497 def initialize(id:, code:, body:, headers:); end498 def ==(other); end499 # Returns the value of attribute body.500 def body; end501 # Sets the attribute body502 #503 # @param value the value to set the attribute body to.504 def body=(_arg0); end505 # Returns the value of attribute code.506 def code; end507 # Sets the attribute code508 #509 # @param value the value to set the attribute code to.510 def code=(_arg0); end511 # Returns the value of attribute headers.512 def headers; end513 # Sets the attribute headers514 #515 # @param value the value to set the attribute headers to.516 def headers=(_arg0); end517 # Returns the value of attribute id.518 def id; end519 def inspect; end520 class << self521 # Creates response from DevTools message.522 #523 # @api private524 def from(id, encoded_body, params); end525 end526end527class Selenium::WebDriver::Dimension < ::Struct528 # Returns the value of attribute height529 #530 # @return [Object] the current value of height531 def height; end532 # Sets the attribute height533 #534 # @param value [Object] the value to set the attribute height to.535 # @return [Object] the newly set value536 def height=(_); end537 # Returns the value of attribute width538 #539 # @return [Object] the current value of width540 def width; end541 # Sets the attribute width542 #543 # @param value [Object] the value to set the attribute width to.544 # @return [Object] the newly set value545 def width=(_); end546 class << self547 def [](*_arg0); end548 def inspect; end549 def keyword_init?; end550 def members; end551 def new(*_arg0); end552 end553end554# The main class through which you control the browser.555#556# @see SearchContext557# @see Navigation558# @see TargetLocator559# @see Options560class Selenium::WebDriver::Driver561 include ::Selenium::WebDriver::SearchContext562 include ::Selenium::WebDriver::TakesScreenshot563 # A new Driver instance with the given bridge.564 # End users should use Selenium::WebDriver.for instead of using this directly.565 #566 # @api private567 # @return [Driver] a new instance of Driver568 def initialize(bridge: T.unsafe(nil), listener: T.unsafe(nil), **opts); end569 # Get the first element matching the given selector. If given a570 # String or Symbol, it will be used as the id of the element.571 #572 # Examples:573 #574 # driver['someElementId'] #=> #<WebDriver::Element:0x1011c3b88>575 # driver[:tag_name => 'div'] #=> #<WebDriver::Element:0x1011c3b88>576 #577 # @param sel [String, Hash] id or selector578 # @return [WebDriver::Element]579 def [](sel); end580 # @return [ActionBuilder]581 # @see ActionBuilder582 def action; end583 # driver.all(class: 'bar') #=> [#<WebDriver::Element:0x1011c3b88, ...]584 def all(*args); end585 def browser; end586 def capabilities; end587 # Close the current window, or the browser if no windows are left.588 def close; end589 # Get the URL of the current page590 #591 # @return [String]592 def current_url; end593 # Execute an asynchronous piece of JavaScript in the context of the594 # currently selected frame or window. Unlike executing595 # execute_script (synchronous JavaScript), scripts596 # executed with this method must explicitly signal they are finished by597 # invoking the provided callback. This callback is always injected into the598 # executed function as the last argument.599 #600 # @param script [String] JavaScript source to execute601 # @param args [WebDriver::Element, Integer, Float, Boolean, NilClass, String, Array] Arguments to the script. May be empty.602 # @return [WebDriver::Element, Integer, Float, Boolean, NilClass, String, Array]603 def execute_async_script(script, *args); end604 # Execute the given JavaScript605 #606 # @param script [String] JavaScript source to execute607 # @param args [WebDriver::Element, Integer, Float, Boolean, NilClass, String, Array] Arguments will be available in the given script in the 'arguments' pseudo-array.608 # @return [WebDriver::Element, Integer, Float, Boolean, NilClass, String, Array] The value returned from the script.609 def execute_script(script, *args); end610 # driver.first(id: 'foo')611 def first(*args); end612 # Opens the specified URL in the browser.613 def get(url); end614 def inspect; end615 def keyboard; end616 # @return [Manager]617 # @see Manager618 def manage; end619 def mouse; end620 # @return [Navigation]621 # @see Navigation622 def navigate; end623 # Get the source of the current page624 #625 # @return [String]626 def page_source; end627 # Quit the browser628 def quit; end629 # @api private630 # @see SearchContext631 def ref; end632 # Execute the given JavaScript633 #634 # @param script [String] JavaScript source to execute635 # @param args [WebDriver::Element, Integer, Float, Boolean, NilClass, String, Array] Arguments will be available in the given script in the 'arguments' pseudo-array.636 # @return [WebDriver::Element, Integer, Float, Boolean, NilClass, String, Array] The value returned from the script.637 #638 # driver.script('function() { ... };')639 def script(script, *args); end640 # information about whether a remote end is in a state in which it can create new sessions,641 # and may include additional meta information.642 #643 # @return [Hash]644 def status; end645 # @return [TargetLocator]646 # @see TargetLocator647 def switch_to; end648 # Get the title of the current page649 #650 # @return [String]651 def title; end652 # Get the current window handle653 #654 # @return [String]655 def window_handle; end656 # Get the window handles of open browser windows.657 #658 # @return [Array]659 # @see TargetLocator#window660 def window_handles; end661 private662 def add_extensions(browser); end663 # Returns the value of attribute bridge.664 def bridge; end665 # @raise [ArgumentError]666 def create_bridge(**opts); end667 def generate_capabilities(cap_array); end668 def screenshot; end669 def service_url(opts); end670 class << self671 # @api private672 # @return [Driver]673 # @see Selenium::WebDriver.for674 def for(browser, opts = T.unsafe(nil)); end675 end676end677# @api private678module Selenium::WebDriver::DriverExtensions; end679module Selenium::WebDriver::DriverExtensions::DownloadsFiles680 # Sets download path for Chromium.681 #682 # @param path [String]683 def download_path=(path); end684end685module Selenium::WebDriver::DriverExtensions::FullPageScreenshot686 # Save a PNG screenshot of the full page to the given path687 #688 # @api public689 def save_full_page_screenshot(path); end690 private691 def full_screenshot; end692end693module Selenium::WebDriver::DriverExtensions::HasAddons694 # Installs addon.695 #696 # @param path [String] Full path to addon file697 # @param temporary [Boolean]698 # @return [String] identifier of installed addon699 def install_addon(path, temporary = T.unsafe(nil)); end700 # Uninstalls addon.701 #702 # @param id [String] Identifier of installed addon703 def uninstall_addon(id); end704end705module Selenium::WebDriver::DriverExtensions::HasApplePermissions706 # Returns permissions.707 #708 # @return [Hash]709 def permissions; end710 # Sets permissions.711 #712 # @example713 # driver.permissions = {'getUserMedia' => true}714 # @param permissions [Hash<Symbol, Boolean>]715 def permissions=(permissions); end716end717module Selenium::WebDriver::DriverExtensions::HasAuthentication718 # Registers basic authentication handler which is automatically719 # used whenever browser gets an authentication required response.720 # This currently relies on DevTools so is only supported in721 # Chromium browsers.722 #723 # @example Authenticate any request724 # driver.register(username: 'admin', password: '123456')725 # @example Authenticate based on URL726 # driver.register(username: 'admin1', password: '123456', uri: /mysite1\.com/)727 # driver.register(username: 'admin2', password: '123456', uri: /mysite2\.com/)728 # @param username [String]729 # @param password [String]730 # @param uri [Regexp] to associate the credentials with731 def register(username:, password:, uri: T.unsafe(nil)); end732 private733 def auth_handlers; end734 def authenticate(request_id, url); end735end736module Selenium::WebDriver::DriverExtensions::HasCDP737 # Returns network conditions.738 #739 # @return [Hash]740 def execute_cdp(cmd, **params); end741end742module Selenium::WebDriver::DriverExtensions::HasCasting743 # Gets error messages when there is any issue in a Cast session.744 #745 # @return [String] the error message746 def cast_issue_message; end747 # Sets a specific sink, using its name, as a Cast session receiver target.748 #749 # @param name [String] the sink to use as the target750 def cast_sink_to_use=(name); end751 # What devices ("sinks") are available to be cast to.752 #753 # @return [Array] list of sinks available for casting with id and name values754 def cast_sinks; end755 # Starts a tab mirroring session on a specific receiver target.756 #757 # @param name [String] the sink to use as the target758 def start_cast_tab_mirroring(name); end759 # Stops the existing Cast session on a specific receiver target.760 #761 # @param name [String] the sink to stop the Cast session762 def stop_casting(name); end763end764module Selenium::WebDriver::DriverExtensions::HasContext765 def context; end766 # Sets the context that Selenium commands are running in using767 # a `with` statement. The state of the context on the server is768 # saved before entering the block, and restored upon exiting it.769 #770 # @param name [String] which permission to set771 # @param value [String] what to set the permission to772 def context=(value); end773end774module Selenium::WebDriver::DriverExtensions::HasDebugger775 # Attaches debugger to session.776 #777 # @example778 # driver.attach_debugger779 # driver.execute_script('debugger')780 # @return [Hash]781 def attach_debugger; end782end783module Selenium::WebDriver::DriverExtensions::HasDevTools784 # Retrieves connection to DevTools.785 #786 # @return [DevTools]787 def devtools; end788end789module Selenium::WebDriver::DriverExtensions::HasLaunching790 # Launches Chromium app specified by id.791 #792 # @param id [String]793 def launch_app(id); end794end795module Selenium::WebDriver::DriverExtensions::HasLocation796 # @raise [Error::UnsupportedOperationError]797 def location; end798 # @raise [Error::UnsupportedOperationError]799 def location=(*_arg0); end800 # @raise [Error::UnsupportedOperationError]801 def set_location; end802end803module Selenium::WebDriver::DriverExtensions::HasLogEvents804 include ::Selenium::WebDriver::Atoms805 # Registers listener to be called whenever browser receives806 # a new Console API message such as console.log() or an unhandled807 # exception.808 #809 # This currently relies on DevTools so is only supported in810 # Chromium browsers.811 #812 # @example Collect console messages813 # logs = []814 # driver.on_log_event(:console) do |event|815 # logs.push(event)816 # end817 # @example Collect JavaScript exceptions818 # exceptions = []819 # driver.on_log_event(:exception) do |event|820 # exceptions.push(event)821 # end822 # @example Collect DOM mutations823 # mutations = []824 # driver.on_log_event(:mutation) do |event|825 # mutations.push(event)826 # end827 # @param kind [Symbol] :console, :exception or :mutation828 # @param block [#call] which is called when event happens829 # @raise [Error::WebDriverError]830 # @yieldparam [DevTools::ConsoleEvent, DevTools::ExceptionEvent, DevTools::MutationEvent]831 def on_log_event(kind, &block); end832 private833 def log_console_events; end834 def log_exception_events; end835 def log_listeners; end836 def log_mutation_event(params); end837 def log_mutation_events; end838 def mutation_listener; end839end840Selenium::WebDriver::DriverExtensions::HasLogEvents::KINDS = T.let(T.unsafe(nil), Array)841module Selenium::WebDriver::DriverExtensions::HasLogs842 def logs; end843end844module Selenium::WebDriver::DriverExtensions::HasNetworkConditions845 # Resets Chromium network emulation settings.846 def delete_network_conditions; end847 # Returns network conditions.848 #849 # @return [Hash]850 def network_conditions; end851 # Sets network conditions852 #853 # @option conditions854 # @option conditions855 # @option conditions856 # @option conditions857 # @option conditions858 # @param conditions [Hash]859 def network_conditions=(conditions); end860end861module Selenium::WebDriver::DriverExtensions::HasNetworkConnection862 # @raise [Error::UnsupportedOperationError]863 def network_connection_type; end864 # @raise [Error::UnsupportedOperationError]865 def network_connection_type=(*_arg0); end866end867module Selenium::WebDriver::DriverExtensions::HasNetworkInterception868 # Intercepts requests coming from browser allowing869 # to either pass them through like proxy or provide870 # a stubbed response instead.871 #872 # @example Log requests and pass through873 # driver.intercept do |request, &continue|874 # puts "#{request.method} #{request.url}"875 # continue.call(request)876 # end877 # @example Stub requests for images878 # driver.intercept do |request, &continue|879 # if request.url.match?(/\.png$/)880 # request.url = 'https://upload.wikimedia.org/wikipedia/commons/d/d5/Selenium_Logo.png'881 # end882 # continue.call(request)883 # end884 # @example Log responses and pass through885 # driver.intercept do |request, &continue|886 # continue.call(request) do |response|887 # puts "#{response.code} #{response.body}"888 # end889 # end890 # @example Mutate specific response891 # driver.intercept do |request, &continue|892 # continue.call(request) do |response|893 # response.body << 'Added by Selenium!' if request.url.include?('/myurl')894 # end895 # end896 # @param block [Proc] which is called when request is intercepted897 # @yieldparam request [DevTools::Request]898 # @yieldparam continue [Proc] block which proceeds with the request and optionally yields response899 def intercept(&block); end900 private901 def fetch_response_body(id); end902 def intercept_request(id, params, &block); end903 # @yield [mutable]904 def intercept_response(id, params); end905 def pending_response_requests; end906end907module Selenium::WebDriver::DriverExtensions::HasPermissions908 # Set one permission.909 #910 # @param name [String] which permission to set911 # @param value [String] what to set the permission to912 def add_permission(name, value); end913 # Set multiple permissions.914 #915 # @param opt [Hash] key/value pairs to set permissions916 def add_permissions(opt); end917end918module Selenium::WebDriver::DriverExtensions::HasPinnedScripts919 # Pins JavaScript snippet that is available during the whole920 # session on every page. This allows to store and call921 # scripts without sending them over the wire every time.922 #923 # @example924 # script = driver.pin_script('return window.location.href')925 # driver.execute_script(script)926 # # navigate to a new page927 # driver.execute_script(script)928 # @param script [String]929 # @return [DevTools::PinnedScript]930 def pin_script(script); end931 # Returns the list of all pinned scripts.932 #933 # @return [Array<DevTools::PinnedScript>]934 def pinned_scripts; end935 # Unpins script making it undefined for the subsequent calls.936 #937 # @param [DevTools::PinnedScript]938 def unpin_script(script); end939end940module Selenium::WebDriver::DriverExtensions::HasRemoteStatus941 def remote_status; end942end943# @api private944module Selenium::WebDriver::DriverExtensions::HasSessionId945 # @api public946 # @return [String] the session id947 def session_id; end948end949# @api private950module Selenium::WebDriver::DriverExtensions::HasWebStorage951 # @api private952 def local_storage; end953 # @api private954 def session_storage; end955end956# @api private957module Selenium::WebDriver::DriverExtensions::PrintsPage958 # Return a Base64 encoded Print Page as a string959 #960 # @api public961 # @see https://w3c.github.io/webdriver/#print-page962 def print_page(**options); end963 # Save a page as a PDF to the given path964 #965 # @api public966 # @example Save Printed Page967 # driver.save_print_page('../printed_page.pdf')968 # @param path [String] to where the pdf should be saved969 def save_print_page(path, **options); end970end971# @api private972module Selenium::WebDriver::DriverExtensions::UploadsFiles973 # Set the file detector to pass local files to a remote WebDriver.974 #975 # The detector is an object that responds to #call, and when called976 # will determine if the given string represents a file. If it does,977 # the path to the file on the local file system should be returned,978 # otherwise nil or false.979 #980 # Example:981 #982 # driver = Selenium::WebDriver.for :remote983 # driver.file_detector = lambda do |args|984 # # args => ["/path/to/file"]985 # str = args.first.to_s986 # str if File.exist?(str)987 # end988 #989 # driver.find_element(:id => "upload").send_keys "/path/to/file"990 #991 # By default, no file detection is performed.992 #993 # @api public994 # @raise [ArgumentError]995 def file_detector=(detector); end996end997module Selenium::WebDriver::Edge998 class << self999 def path; end1000 def path=(path); end1001 end1002end1003# Driver implementation for Microsoft Edge.1004#1005# @api private1006class Selenium::WebDriver::Edge::Driver < ::Selenium::WebDriver::Chrome::Driver1007 # @api private1008 def browser; end1009 private1010 # @api private1011 def devtools_address; end1012end1013module Selenium::WebDriver::Edge::Features1014 include ::Selenium::WebDriver::Chrome::Features1015 def commands(command); end1016end1017Selenium::WebDriver::Edge::Features::EDGE_COMMANDS = T.let(T.unsafe(nil), Hash)1018class Selenium::WebDriver::Edge::Options < ::Selenium::WebDriver::Chrome::Options1019 protected1020 def enable_logging(browser_options); end1021 private1022 def binary_path; end1023end1024Selenium::WebDriver::Edge::Options::BROWSER = T.let(T.unsafe(nil), String)1025Selenium::WebDriver::Edge::Options::KEY = T.let(T.unsafe(nil), String)1026# @private1027class Selenium::WebDriver::Edge::Profile < ::Selenium::WebDriver::Chrome::Profile; end1028class Selenium::WebDriver::Edge::Service < ::Selenium::WebDriver::Chrome::Service; end1029Selenium::WebDriver::Edge::Service::DEFAULT_PORT = T.let(T.unsafe(nil), Integer)1030Selenium::WebDriver::Edge::Service::EXECUTABLE = T.let(T.unsafe(nil), String)1031Selenium::WebDriver::Edge::Service::MISSING_TEXT = T.let(T.unsafe(nil), String)1032Selenium::WebDriver::Edge::Service::SHUTDOWN_SUPPORTED = T.let(T.unsafe(nil), TrueClass)1033class Selenium::WebDriver::Element1034 include ::Selenium::WebDriver::SearchContext1035 include ::Selenium::WebDriver::TakesScreenshot1036 # Creates a new Element1037 #1038 # @api private1039 # @return [Element] a new instance of Element1040 def initialize(bridge, id); end1041 def ==(other); end1042 # This method attempts to provide the most likely desired current value for the attribute1043 # of the element, even when that desired value is actually a JavaScript property.1044 # It is implemented with a custom JavaScript atom. To obtain the exact value of the attribute or property,1045 # use #dom_attribute or #property methods respectively.1046 #1047 # More exactly, this method will return the value of the property with the given name,1048 # if it exists. If it does not, then the value of the attribute with the given name is returned.1049 # If neither exists, null is returned.1050 #1051 # The "style" attribute is converted as best can be to a text representation with a trailing semi-colon.1052 #1053 # The following are deemed to be "boolean" attributes, and will return either "true" or "false":1054 #1055 # async, autofocus, autoplay, checked, compact, complete, controls, declare, defaultchecked,1056 # defaultselected, defer, disabled, draggable, ended, formnovalidate, hidden, indeterminate,1057 # iscontenteditable, ismap, itemscope, loop, multiple, muted, nohref, noresize, noshade, novalidate,1058 # nowrap, open, paused, pubdate, readonly, required, reversed, scoped, seamless, seeking,1059 # selected, spellcheck, truespeed, willvalidate1060 #1061 # Finally, the following commonly mis-capitalized attribute/property names are evaluated as expected:1062 #1063 # When the value of "class" is requested, the "className" property is returned.1064 # When the value of "readonly" is requested, the "readOnly" property is returned.1065 #1066 # @param name [String] attribute name1067 # @return [String, nil] attribute value1068 # @see #dom_attribute1069 # @see #property element['class'] or element[:class] #=> "someclass"1070 def [](name); end1071 # Gets the computed WAI-ARIA label of element.1072 #1073 # @return [String]1074 def accessible_name; end1075 # element.all(class: 'bar')1076 def all(*args); end1077 # Gets the computed WAI-ARIA role of element1078 #1079 # @return [String]1080 def aria_role; end1081 # For Rails 3 - http://jonathanjulian.com/2010/04/rails-to_json-or-as_json/1082 #1083 # @api private1084 def as_json(*_arg0); end1085 # This method attempts to provide the most likely desired current value for the attribute1086 # of the element, even when that desired value is actually a JavaScript property.1087 # It is implemented with a custom JavaScript atom. To obtain the exact value of the attribute or property,1088 # use #dom_attribute or #property methods respectively.1089 #1090 # More exactly, this method will return the value of the property with the given name,1091 # if it exists. If it does not, then the value of the attribute with the given name is returned.1092 # If neither exists, null is returned.1093 #1094 # The "style" attribute is converted as best can be to a text representation with a trailing semi-colon.1095 #1096 # The following are deemed to be "boolean" attributes, and will return either "true" or "false":1097 #1098 # async, autofocus, autoplay, checked, compact, complete, controls, declare, defaultchecked,1099 # defaultselected, defer, disabled, draggable, ended, formnovalidate, hidden, indeterminate,1100 # iscontenteditable, ismap, itemscope, loop, multiple, muted, nohref, noresize, noshade, novalidate,1101 # nowrap, open, paused, pubdate, readonly, required, reversed, scoped, seamless, seeking,1102 # selected, spellcheck, truespeed, willvalidate1103 #1104 # Finally, the following commonly mis-capitalized attribute/property names are evaluated as expected:1105 #1106 # When the value of "class" is requested, the "className" property is returned.1107 # When the value of "readonly" is requested, the "readOnly" property is returned.1108 #1109 # @param name [String] attribute name1110 # @return [String, nil] attribute value1111 # @see #dom_attribute1112 # @see #property1113 def attribute(name); end1114 # If this element is a text entry element, this will clear the value. Has no effect on other1115 # elements. Text entry elements are INPUT and TEXTAREA elements.1116 #1117 # Note that the events fired by this event may not be as you'd expect. In particular, we don't1118 # fire any keyboard or mouse events. If you want to ensure keyboard events are1119 # fired, consider using #send_keys with the backspace key. To ensure you get a change event,1120 # consider following with a call to #send_keys with the tab key.1121 def clear; end1122 # Click this element. If this causes a new page to load, this method will1123 # attempt to block until the page has loaded. At this point, you should1124 # discard all references to this element and any further operations1125 # performed on this element will raise a StaleElementReferenceError1126 # unless you know that the element and the page will still be present. If1127 # click() causes a new page to be loaded via an event or is done by1128 # sending a native event then the method will *not* wait for it to be1129 # loaded and the caller should verify that a new page has been loaded.1130 #1131 # There are some preconditions for an element to be clicked. The element1132 # must be visible and it must have a height and width greater then 0.1133 #1134 # Equivalent to:1135 # driver.action.click(element)1136 #1137 # @example Click on a button1138 #1139 # driver.find_element(tag_name: "button").click1140 # @raise [StaleElementReferenceError] if the element no longer exists as1141 # defined1142 def click; end1143 # Get the value of the given CSS property1144 #1145 # Note that shorthand CSS properties (e.g. background, font, border, border-top, margin,1146 # margin-top, padding, padding-top, list-style, outline, pause, cue) are not returned,1147 # in accordance with the DOM CSS2 specification - you should directly access the longhand1148 # properties (e.g. background-color) to access the desired values.1149 #1150 # @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration1151 def css_value(prop); end1152 # Is the element displayed?1153 #1154 # @return [Boolean]1155 def displayed?; end1156 # Gets the value of a declared HTML attribute of this element.1157 #1158 # As opposed to the #attribute method, this method1159 # only returns attributes declared in the element's HTML markup.1160 #1161 # If the attribute is not set, nil is returned.1162 #1163 # @param name [String] attribute name1164 # @return [String, nil] attribute value1165 # @see #attribute1166 # @see #property1167 def dom_attribute(name); end1168 # Is the element enabled?1169 #1170 # @return [Boolean]1171 def enabled?; end1172 def eql?(other); end1173 # element.first(id: 'foo')1174 def first(*args); end1175 def hash; end1176 def inspect; end1177 # Get the location of this element.1178 #1179 # @return [WebDriver::Point]1180 def location; end1181 # Determine an element's location on the screen once it has been scrolled into view.1182 #1183 # @return [WebDriver::Point]1184 def location_once_scrolled_into_view; end1185 # Gets the value of a JavaScript property of this element1186 # This will return the current value,1187 # even if this has been modified after the page has been loaded.1188 # If the value is not set, nil is returned.1189 #1190 # @param name [String] property name1191 # @return [String, nil] property value1192 def property(name); end1193 # Get the dimensions and coordinates of this element.1194 #1195 # @return [WebDriver::Rectangle]1196 def rect; end1197 # @api private1198 # @see SearchContext1199 def ref; end1200 # Is the element selected?1201 #1202 # @return [Boolean]1203 def selected?; end1204 # Send keystrokes to this element1205 #1206 # Examples:1207 #1208 # element.send_keys "foo" #=> value: 'foo'1209 # element.send_keys "tet", :arrow_left, "s" #=> value: 'test'1210 # element.send_keys [:control, 'a'], :space #=> value: ' '1211 #1212 # @param args [String, Symbol, Array] keystrokes to send1213 # @see Keys::KEYS1214 def send_key(*args); end1215 # Send keystrokes to this element1216 #1217 # Examples:1218 #1219 # element.send_keys "foo" #=> value: 'foo'1220 # element.send_keys "tet", :arrow_left, "s" #=> value: 'test'1221 # element.send_keys [:control, 'a'], :space #=> value: ' '1222 #1223 # @param args [String, Symbol, Array] keystrokes to send1224 # @see Keys::KEYS1225 def send_keys(*args); end1226 # Returns the shadow root of an element.1227 #1228 # @return [WebDriver::ShadowRoot]1229 def shadow_root; end1230 # Get the size of this element1231 #1232 # @return [WebDriver::Dimension]1233 def size; end1234 # Get the value of the given CSS property1235 #1236 # Note that shorthand CSS properties (e.g. background, font, border, border-top, margin,1237 # margin-top, padding, padding-top, list-style, outline, pause, cue) are not returned,1238 # in accordance with the DOM CSS2 specification - you should directly access the longhand1239 # properties (e.g. background-color) to access the desired values.1240 #1241 # @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration1242 def style(prop); end1243 # Submit this element1244 def submit; end1245 # Get the tag name of the element.1246 #1247 # @example Get the tagname of an INPUT element(returns "input")1248 #1249 # driver.find_element(xpath: "//input").tag_name1250 # @return [String] The tag name of this element.1251 def tag_name; end1252 # Get the text content of this element1253 #1254 # @return [String]1255 def text; end1256 # Convert to a WebElement JSON Object for transmission over the wire.1257 #1258 # @api private1259 # @see https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#basic-terms-and-concepts1260 def to_json(*_arg0); end1261 private1262 # Returns the value of attribute bridge.1263 def bridge; end1264 def screenshot; end1265 # @return [Boolean]1266 def selectable?; end1267end1268Selenium::WebDriver::Element::ELEMENT_KEY = T.let(T.unsafe(nil), String)1269module Selenium::WebDriver::Error1270 class << self1271 # Returns exception from its string representation.1272 #1273 # @param error [String, nil]1274 def for_error(error); end1275 end1276end1277# A command failed because the referenced shadow root is no longer attached to the DOM.1278class Selenium::WebDriver::Error::DetachedShadowRootError < ::Selenium::WebDriver::Error::WebDriverError; end1279# The Element Click command could not be completed because the element receiving the events1280# is obscuring the element that was requested clicked.1281class Selenium::WebDriver::Error::ElementClickInterceptedError < ::Selenium::WebDriver::Error::WebDriverError; end1282# A command could not be completed because the element is not pointer or keyboard1283# interactable.1284class Selenium::WebDriver::Error::ElementNotInteractableError < ::Selenium::WebDriver::Error::WebDriverError; end1285# A command could not be completed because TLS certificate is expired1286# or invalid.1287class Selenium::WebDriver::Error::InsecureCertificateError < ::Selenium::WebDriver::Error::WebDriverError; end1288# The arguments passed to a command are either invalid or malformed.1289class Selenium::WebDriver::Error::InvalidArgumentError < ::Selenium::WebDriver::Error::WebDriverError; end1290# An illegal attempt was made to set a cookie under a different domain than the current page.1291class Selenium::WebDriver::Error::InvalidCookieDomainError < ::Selenium::WebDriver::Error::WebDriverError; end1292# The target element is in an invalid state, rendering it impossible to interact with, for1293# example if you click a disabled element.1294class Selenium::WebDriver::Error::InvalidElementStateError < ::Selenium::WebDriver::Error::WebDriverError; end1295# Argument was an invalid selector.1296class Selenium::WebDriver::Error::InvalidSelectorError < ::Selenium::WebDriver::Error::WebDriverError; end1297# Occurs if the given session id is not in the list of active sessions, meaning the session1298# either does not exist or that it's not active.1299class Selenium::WebDriver::Error::InvalidSessionIdError < ::Selenium::WebDriver::Error::WebDriverError; end1300# An error occurred while executing JavaScript supplied by the user.1301class Selenium::WebDriver::Error::JavascriptError < ::Selenium::WebDriver::Error::WebDriverError; end1302# The target for mouse interaction is not in the browser's viewport and cannot be brought1303# into that viewport.1304class Selenium::WebDriver::Error::MoveTargetOutOfBoundsError < ::Selenium::WebDriver::Error::WebDriverError; end1305# An attempt was made to operate on a modal dialog when one was not open:1306class Selenium::WebDriver::Error::NoSuchAlertError < ::Selenium::WebDriver::Error::WebDriverError; end1307# No cookie matching the given path name was found amongst the associated cookies of the1308# current browsing context's active document.1309class Selenium::WebDriver::Error::NoSuchCookieError < ::Selenium::WebDriver::Error::WebDriverError; end1310# An element could not be located on the page using the given search parameters.1311class Selenium::WebDriver::Error::NoSuchElementError < ::Selenium::WebDriver::Error::WebDriverError; end1312# A command to switch to a frame could not be satisfied because the frame could not be found.1313class Selenium::WebDriver::Error::NoSuchFrameError < ::Selenium::WebDriver::Error::WebDriverError; end1314# The element does not have a shadow root.1315class Selenium::WebDriver::Error::NoSuchShadowRootError < ::Selenium::WebDriver::Error::WebDriverError; end1316# A command to switch to a window could not be satisfied because1317# the window could not be found.1318class Selenium::WebDriver::Error::NoSuchWindowError < ::Selenium::WebDriver::Error::WebDriverError; end1319# A script did not complete before its timeout expired.1320class Selenium::WebDriver::Error::ScriptTimeoutError < ::Selenium::WebDriver::Error::WebDriverError; end1321class Selenium::WebDriver::Error::ServerError < ::StandardError1322 # @return [ServerError] a new instance of ServerError1323 def initialize(response); end1324end1325# A new session could not be created.1326class Selenium::WebDriver::Error::SessionNotCreatedError < ::Selenium::WebDriver::Error::WebDriverError; end1327# A command failed because the referenced element is no longer attached to the DOM.1328class Selenium::WebDriver::Error::StaleElementReferenceError < ::Selenium::WebDriver::Error::WebDriverError; end1329# An operation did not complete before its timeout expired.1330class Selenium::WebDriver::Error::TimeoutError < ::Selenium::WebDriver::Error::WebDriverError; end1331# A screen capture was made impossible.1332class Selenium::WebDriver::Error::UnableToCaptureScreenError < ::Selenium::WebDriver::Error::WebDriverError; end1333# A command to set a cookie's value could not be satisfied.1334class Selenium::WebDriver::Error::UnableToSetCookieError < ::Selenium::WebDriver::Error::WebDriverError; end1335# A modal dialog was open, blocking this operation.1336class Selenium::WebDriver::Error::UnexpectedAlertOpenError < ::Selenium::WebDriver::Error::WebDriverError; end1337# A command could not be executed because the remote end is not aware of it.1338class Selenium::WebDriver::Error::UnknownCommandError < ::Selenium::WebDriver::Error::WebDriverError; end1339# An unknown error occurred in the remote end while processing the command.1340class Selenium::WebDriver::Error::UnknownError < ::Selenium::WebDriver::Error::WebDriverError; end1341# The requested command matched a known URL but did not match an method for that URL.1342class Selenium::WebDriver::Error::UnknownMethodError < ::Selenium::WebDriver::Error::WebDriverError; end1343# Indicates that a command that should have executed properly cannot be supported for some1344# reason.1345class Selenium::WebDriver::Error::UnsupportedOperationError < ::Selenium::WebDriver::Error::WebDriverError; end1346class Selenium::WebDriver::Error::WebDriverError < ::StandardError; end1347# @api private1348module Selenium::WebDriver::FileReaper1349 class << self1350 # @api private1351 def <<(file); end1352 # @api private1353 # @raise [Error::WebDriverError]1354 def reap(file); end1355 # @api private1356 def reap!; end1357 # @api private1358 def reap=(_arg0); end1359 # @api private1360 # @return [Boolean]1361 def reap?; end1362 # @api private1363 def tmp_files; end1364 end1365end1366module Selenium::WebDriver::Firefox1367 class << self1368 def driver_path; end1369 def driver_path=(path); end1370 def path; end1371 def path=(path); end1372 end1373end1374Selenium::WebDriver::Firefox::DEFAULT_ASSUME_UNTRUSTED_ISSUER = T.let(T.unsafe(nil), TrueClass)1375Selenium::WebDriver::Firefox::DEFAULT_PORT = T.let(T.unsafe(nil), Integer)1376# Mozilla Automation Team asked to only support 851377# until WebDriver Bidi is available.1378Selenium::WebDriver::Firefox::DEVTOOLS_VERSION = T.let(T.unsafe(nil), Integer)1379# Driver implementation for Firefox using GeckoDriver.1380#1381# @api private1382class Selenium::WebDriver::Firefox::Driver < ::Selenium::WebDriver::Driver1383 # @api private1384 def browser; end1385 private1386 # @api private1387 def devtools_url; end1388 # @api private1389 def devtools_version; end1390end1391# @api private1392Selenium::WebDriver::Firefox::Driver::EXTENSIONS = T.let(T.unsafe(nil), Array)1393# @api private1394class Selenium::WebDriver::Firefox::Extension1395 # @api private1396 # @raise [Error::WebDriverError]1397 # @return [Extension] a new instance of Extension1398 def initialize(path); end1399 # @api private1400 def write_to(extensions_dir); end1401 private1402 # @api private1403 def applications_gecko_id(manifest); end1404 # @api private1405 def create_root; end1406 # @api private1407 def name_and_version(manifest); end1408 # @api private1409 def read_id(directory); end1410 # @api private1411 # @raise [Error::WebDriverError]1412 def read_id_from_install_rdf(directory); end1413 # @api private1414 def read_id_from_manifest_json(directory); end1415end1416# @api private1417Selenium::WebDriver::Firefox::Extension::NAMESPACE = T.let(T.unsafe(nil), String)1418module Selenium::WebDriver::Firefox::Features1419 def commands(command); end1420 def context; end1421 def context=(context); end1422 def full_screenshot; end1423 def install_addon(path, temporary); end1424 def uninstall_addon(id); end1425end1426Selenium::WebDriver::Firefox::Features::FIREFOX_COMMANDS = T.let(T.unsafe(nil), Hash)1427class Selenium::WebDriver::Firefox::Options < ::Selenium::WebDriver::Options1428 # Create a new Options instance, only for W3C-capable versions of Firefox.1429 #1430 # @example1431 # options = Selenium::WebDriver::Firefox::Options.new(args: ['--host=127.0.0.1'])1432 # driver = Selenium::WebDriver.for :firefox, capabilities: options1433 # @option opts1434 # @option opts1435 # @option opts1436 # @option opts1437 # @option opts1438 # @option opts1439 # @param opts [Hash] the pre-defined options to create the Firefox::Options with1440 # @return [Options] a new instance of Options1441 def initialize(log_level: T.unsafe(nil), **opts); end1442 # Add a command-line argument to use when starting Firefox.1443 #1444 # @example Start geckodriver on a specific host1445 # options = Selenium::WebDriver::Firefox::Options.new1446 # options.add_argument('--host=127.0.0.1')1447 # @param arg [String] The command-line argument to add1448 def add_argument(arg); end1449 # Add a preference that is only applied to the user profile in use.1450 #1451 # @example Set the default homepage1452 # options = Selenium::WebDriver::Firefox::Options.new1453 # options.add_preference('browser.startup.homepage', 'http://www.seleniumhq.com/')1454 # @param name [String] Key of the preference1455 # @param value [Boolean, String, Integer] Value of the preference1456 def add_preference(name, value); end1457 # Returns the value of attribute debugger_address.1458 def debugger_address; end1459 # Sets the attribute debugger_address1460 #1461 # @param value the value to set the attribute debugger_address to.1462 def debugger_address=(_arg0); end1463 # Enables mobile browser use on Android.1464 #1465 # @param package [String] The package name of the Chrome or WebView app.1466 # @param serial_number [String] The serial number of the device on which to launch the application.1467 # If not specified and multiple devices are attached, an error will be returned.1468 # @param activity [String] The fully qualified class name of the activity to be launched.1469 # @param intent_arguments [Array] Arguments to launch the intent with.1470 # @see https://developer.mozilla.org/en-US/docs/Web/WebDriver/Capabilities/firefoxOptions#android1471 def enable_android(package: T.unsafe(nil), serial_number: T.unsafe(nil), activity: T.unsafe(nil), intent_arguments: T.unsafe(nil)); end1472 # Run Firefox in headless mode.1473 #1474 # @example Enable headless mode1475 # options = Selenium::WebDriver::Firefox::Options.new1476 # options.headless!1477 def headless!; end1478 def log_level; end1479 def log_level=(level); end1480 # NOTE: special handling of 'profile' to validate when set instead of when used1481 def profile; end1482 # Sets Firefox profile.1483 #1484 # @example Set the custom profile1485 # profile = Selenium::WebDriver::Firefox::Profile.new1486 # options = Selenium::WebDriver::Firefox::Options.new1487 # options.profile = profile1488 # @example Use existing profile1489 # options = Selenium::WebDriver::Firefox::Options.new1490 # options.profile = 'myprofile'1491 # @param profile [Profile, String] Profile to be used1492 def profile=(profile); end1493 private1494 # @return [Boolean]1495 def camelize?(key); end1496 def process_browser_options(browser_options); end1497 def process_profile(profile); end1498end1499Selenium::WebDriver::Firefox::Options::BROWSER = T.let(T.unsafe(nil), String)1500# see: https://firefox-source-docs.mozilla.org/testing/geckodriver/Capabilities.html1501Selenium::WebDriver::Firefox::Options::CAPABILITIES = T.let(T.unsafe(nil), Hash)1502Selenium::WebDriver::Firefox::Options::KEY = T.let(T.unsafe(nil), String)1503class Selenium::WebDriver::Firefox::Profile1504 include ::Selenium::WebDriver::ProfileHelper1505 extend ::Selenium::WebDriver::ProfileHelper::ClassMethods1506 # Create a new Profile instance1507 #1508 # @example User configured profile1509 #1510 # profile = Selenium::WebDriver::Firefox::Profile.new1511 # profile['network.proxy.http'] = 'localhost'1512 # profile['network.proxy.http_port'] = 90901513 #1514 # driver = Selenium::WebDriver.for :firefox, :profile => profile1515 # @return [Profile] a new instance of Profile1516 def initialize(model = T.unsafe(nil)); end1517 # Set a preference for this particular profile.1518 #1519 # @see http://kb.mozillazine.org/About:config_entries1520 # @see http://preferential.mozdev.org/preferences.html1521 def []=(key, value); end1522 # Add the extension (directory, .zip or .xpi) at the given path to the profile.1523 def add_extension(path, name = T.unsafe(nil)); end1524 def as_json; end1525 def layout_on_disk; end1526 # Sets the attribute load_no_focus_lib1527 #1528 # @param value the value to set the attribute load_no_focus_lib to.1529 def load_no_focus_lib=(_arg0); end1530 # Returns the value of attribute log_file.1531 def log_file; end1532 def log_file=(file); end1533 # Returns the value of attribute name.1534 def name; end1535 def port=(port); end1536 # @raise [TypeError]1537 def proxy=(proxy); end1538 # Sets the attribute secure_ssl1539 #1540 # @param value the value to set the attribute secure_ssl to.1541 def secure_ssl=(_arg0); end1542 private1543 def delete_extensions_cache(directory); end1544 def delete_lock_files(directory); end1545 def extension_name_for(path); end1546 def install_extensions(directory); end1547 def read_model_prefs; end1548 def read_user_prefs(path); end1549 def set_manual_proxy_preference(key, value); end1550 # @return [Boolean]1551 def stringified?(str); end1552 def update_user_prefs_in(directory); end1553 def write_prefs(prefs, path); end1554 class << self1555 def decoded(json); end1556 # @raise [Error::WebDriverError]1557 def from_name(name); end1558 def ini; end1559 end1560end1561Selenium::WebDriver::Firefox::Profile::DEFAULT_PREFERENCES = T.let(T.unsafe(nil), Hash)1562Selenium::WebDriver::Firefox::Profile::VALID_PREFERENCE_TYPES = T.let(T.unsafe(nil), Array)1563# @api private1564class Selenium::WebDriver::Firefox::ProfilesIni1565 # @api private1566 # @return [ProfilesIni] a new instance of ProfilesIni1567 def initialize; end1568 # @api private1569 def [](name); end1570 # @api private1571 def refresh; end1572 private1573 # @api private1574 def parse; end1575 # @api private1576 def path_for(name, is_relative, path); end1577end1578class Selenium::WebDriver::Firefox::Service < ::Selenium::WebDriver::Service1579 private1580 # NOTE: This processing is deprecated1581 def extract_service_args(driver_opts); end1582end1583Selenium::WebDriver::Firefox::Service::DEFAULT_PORT = T.let(T.unsafe(nil), Integer)1584Selenium::WebDriver::Firefox::Service::EXECUTABLE = T.let(T.unsafe(nil), String)1585Selenium::WebDriver::Firefox::Service::MISSING_TEXT = T.let(T.unsafe(nil), String)1586module Selenium::WebDriver::HTML5; end1587class Selenium::WebDriver::HTML5::LocalStorage1588 include ::Enumerable1589 include ::Selenium::WebDriver::HTML5::SharedWebStorage1590 # @api private1591 # @return [LocalStorage] a new instance of LocalStorage1592 def initialize(bridge); end1593 def [](key); end1594 def []=(key, value); end1595 def clear; end1596 def delete(key); end1597 def keys; end1598 def size; end1599end1600class Selenium::WebDriver::HTML5::SessionStorage1601 include ::Enumerable1602 include ::Selenium::WebDriver::HTML5::SharedWebStorage1603 # @api private1604 # @return [SessionStorage] a new instance of SessionStorage1605 def initialize(bridge); end1606 def [](key); end1607 def []=(key, value); end1608 def clear; end1609 def delete(key); end1610 def keys; end1611 def size; end1612end1613module Selenium::WebDriver::HTML5::SharedWebStorage1614 include ::Enumerable1615 def each; end1616 # @return [Boolean]1617 def empty?; end1618 # @raise [KeyError]1619 def fetch(key); end1620 # @return [Boolean]1621 def has_key?(key); end1622 # @return [Boolean]1623 def key?(key); end1624 # @return [Boolean]1625 def member?(key); end1626end1627module Selenium::WebDriver::IE1628 class << self1629 def driver_path; end1630 def driver_path=(path); end1631 end1632end1633# Driver implementation for Internet Explorer supporting1634# both OSS and W3C dialects of JSON wire protocol.1635#1636# @api private1637class Selenium::WebDriver::IE::Driver < ::Selenium::WebDriver::Driver1638 # @api private1639 def browser; end1640end1641# @api private1642Selenium::WebDriver::IE::Driver::EXTENSIONS = T.let(T.unsafe(nil), Array)1643class Selenium::WebDriver::IE::Options < ::Selenium::WebDriver::Options1644 # Create a new Options instance1645 #1646 # @example1647 # options = Selenium::WebDriver::IE::Options.new(args: ['--host=127.0.0.1'])1648 # driver = Selenium::WebDriver.for(:ie, capabilities: options)1649 # @example1650 # options = Selenium::WebDriver::IE::Options.new1651 # options.element_scroll_behavior = Selenium::WebDriver::IE::Options::SCROLL_BOTTOM1652 # driver = Selenium::WebDriver.for(:ie, capabilities: options)1653 # @option opts1654 # @option opts1655 # @option opts1656 # @option opts1657 # @option opts1658 # @option opts1659 # @option opts1660 # @option opts1661 # @option opts1662 # @option opts1663 # @option opts1664 # @option opts1665 # @option opts1666 # @option opts1667 # @option opts1668 # @option opts1669 # @param opts [Hash] the pre-defined options1670 # @return [Options] a new instance of Options1671 def initialize(**opts); end1672 # Add a command-line argument to use when starting Internet Explorer.1673 #1674 # @param arg [String] The command-line argument to add1675 def add_argument(arg); end1676 # Returns the value of attribute args.1677 def args; end1678 private1679 def process_browser_options(browser_options); end1680end1681Selenium::WebDriver::IE::Options::BROWSER = T.let(T.unsafe(nil), String)1682Selenium::WebDriver::IE::Options::CAPABILITIES = T.let(T.unsafe(nil), Hash)1683Selenium::WebDriver::IE::Options::KEY = T.let(T.unsafe(nil), String)1684Selenium::WebDriver::IE::Options::SCROLL_BOTTOM = T.let(T.unsafe(nil), Integer)1685Selenium::WebDriver::IE::Options::SCROLL_TOP = T.let(T.unsafe(nil), Integer)1686class Selenium::WebDriver::IE::Service < ::Selenium::WebDriver::Service1687 private1688 # NOTE: This processing is deprecated1689 def extract_service_args(driver_opts); end1690end1691Selenium::WebDriver::IE::Service::DEFAULT_PORT = T.let(T.unsafe(nil), Integer)1692Selenium::WebDriver::IE::Service::EXECUTABLE = T.let(T.unsafe(nil), String)1693Selenium::WebDriver::IE::Service::MISSING_TEXT = T.let(T.unsafe(nil), String)1694Selenium::WebDriver::IE::Service::SHUTDOWN_SUPPORTED = T.let(T.unsafe(nil), TrueClass)1695module Selenium::WebDriver::Interactions1696 class << self1697 def key(name); end1698 def none(name = T.unsafe(nil)); end1699 def pointer(kind, **kwargs); end1700 end1701end1702class Selenium::WebDriver::Interactions::InputDevice1703 # @return [InputDevice] a new instance of InputDevice1704 def initialize(name = T.unsafe(nil)); end1705 # Returns the value of attribute actions.1706 def actions; end1707 # @raise [TypeError]1708 def add_action(action); end1709 def clear_actions; end1710 def create_pause(duration = T.unsafe(nil)); end1711 # Returns the value of attribute name.1712 def name; end1713 # Determine if only pauses are present1714 #1715 # @return [Boolean]1716 def no_actions?; end1717end1718class Selenium::WebDriver::Interactions::Interaction1719 # @return [Interaction] a new instance of Interaction1720 def initialize(source); end1721 # Returns the value of attribute source.1722 def source; end1723end1724Selenium::WebDriver::Interactions::Interaction::PAUSE = T.let(T.unsafe(nil), Symbol)1725Selenium::WebDriver::Interactions::KEY = T.let(T.unsafe(nil), Symbol)1726class Selenium::WebDriver::Interactions::KeyInput < ::Selenium::WebDriver::Interactions::InputDevice1727 def create_key_down(key); end1728 def create_key_up(key); end1729 def encode; end1730 def type; end1731end1732Selenium::WebDriver::Interactions::KeyInput::SUBTYPES = T.let(T.unsafe(nil), Hash)1733class Selenium::WebDriver::Interactions::KeyInput::TypingInteraction < ::Selenium::WebDriver::Interactions::Interaction1734 # @return [TypingInteraction] a new instance of TypingInteraction1735 def initialize(source, type, key); end1736 # @raise [TypeError]1737 def assert_type(type); end1738 def encode; end1739 # Returns the value of attribute type.1740 def type; end1741end1742Selenium::WebDriver::Interactions::NONE = T.let(T.unsafe(nil), Symbol)1743class Selenium::WebDriver::Interactions::NoneInput < ::Selenium::WebDriver::Interactions::InputDevice1744 def encode; end1745 def type; end1746end1747Selenium::WebDriver::Interactions::POINTER = T.let(T.unsafe(nil), Symbol)1748class Selenium::WebDriver::Interactions::Pause < ::Selenium::WebDriver::Interactions::Interaction1749 # @return [Pause] a new instance of Pause1750 def initialize(source, duration = T.unsafe(nil)); end1751 def encode; end1752 def type; end1753end1754# Move1755class Selenium::WebDriver::Interactions::PointerCancel < ::Selenium::WebDriver::Interactions::Interaction1756 def encode; end1757 def type; end1758end1759class Selenium::WebDriver::Interactions::PointerInput < ::Selenium::WebDriver::Interactions::InputDevice1760 # @return [PointerInput] a new instance of PointerInput1761 def initialize(kind, name: T.unsafe(nil)); end1762 # @raise [TypeError]1763 def assert_kind(pointer); end1764 def create_pointer_cancel; end1765 def create_pointer_down(button); end1766 def create_pointer_move(duration: T.unsafe(nil), x: T.unsafe(nil), y: T.unsafe(nil), element: T.unsafe(nil), origin: T.unsafe(nil)); end1767 def create_pointer_up(button); end1768 def encode; end1769 # Returns the value of attribute kind.1770 def kind; end1771 def type; end1772end1773Selenium::WebDriver::Interactions::PointerInput::KIND = T.let(T.unsafe(nil), Hash)1774# PointerPress1775class Selenium::WebDriver::Interactions::PointerMove < ::Selenium::WebDriver::Interactions::Interaction1776 # @return [PointerMove] a new instance of PointerMove1777 def initialize(source, duration, x, y, element: T.unsafe(nil), origin: T.unsafe(nil)); end1778 def encode; end1779 def type; end1780end1781Selenium::WebDriver::Interactions::PointerMove::ORIGINS = T.let(T.unsafe(nil), Array)1782Selenium::WebDriver::Interactions::PointerMove::POINTER = T.let(T.unsafe(nil), Symbol)1783Selenium::WebDriver::Interactions::PointerMove::VIEWPORT = T.let(T.unsafe(nil), Symbol)1784# PointerInput1785class Selenium::WebDriver::Interactions::PointerPress < ::Selenium::WebDriver::Interactions::Interaction1786 # @return [PointerPress] a new instance of PointerPress1787 def initialize(source, direction, button); end1788 # @raise [ArgumentError]1789 def assert_button(button); end1790 # @raise [TypeError]1791 def assert_direction(direction); end1792 def encode; end1793 def type; end1794end1795Selenium::WebDriver::Interactions::PointerPress::BUTTONS = T.let(T.unsafe(nil), Hash)1796Selenium::WebDriver::Interactions::PointerPress::DIRECTIONS = T.let(T.unsafe(nil), Hash)1797Selenium::WebDriver::Interactions::SOURCE_TYPES = T.let(T.unsafe(nil), Array)1798module Selenium::WebDriver::KeyActions1799 # Performs a key press. Does not release the key - subsequent interactions may assume it's kept pressed.1800 # Note that the key is never released implicitly - either ActionBuilder#key_up(key) or ActionBuilder#release_actions1801 # must be called to release the key.1802 #1803 # @example Press a key1804 #1805 # driver.action.key_down(:control).perform1806 # @example Press a key on an element1807 #1808 # el = driver.find_element(id: "some_id")1809 # driver.action.key_down(el, :shift).perform1810 # @overload key_down1811 # @overload key_down1812 # @return [ActionBuilder] A self reference1813 def key_down(*args, device: T.unsafe(nil)); end1814 # Performs a key release.1815 # Releasing a non-depressed key will yield undefined behaviour.1816 #1817 # @example Release a key1818 #1819 # driver.action.key_up(:shift).perform1820 # @example Release a key from an element1821 #1822 # el = driver.find_element(id: "some_id")1823 # driver.action.key_up(el, :alt).perform1824 # @overload key_up1825 # @overload key_up1826 # @return [ActionBuilder] A self reference1827 def key_up(*args, device: T.unsafe(nil)); end1828 # Sends keys to the active element. This differs from calling1829 # Element#send_keys(keys) on the active element in two ways:1830 #1831 # * The modifier keys included in this call are not released.1832 # * There is no attempt to re-focus the element - so send_keys(:tab) for switching elements should work.1833 #1834 # @example Send the text "help" to an element1835 #1836 # el = driver.find_element(id: "some_id")1837 # driver.action.send_keys(el, "help").perform1838 # @example Send the text "help" to the currently focused element1839 #1840 # driver.action.send_keys("help").perform1841 # @overload send_keys1842 # @overload send_keys1843 # @return [ActionBuilder] A self reference1844 def send_keys(*args, device: T.unsafe(nil)); end1845 private1846 # @api private1847 # @option args1848 # @option args1849 # @overload key_down1850 # @overload key_down1851 # @param args [Array]1852 # @param action [Symbol] The name of the key action to perform1853 # @param device [Symbol, String] optional name of the KeyInput device to press the key on1854 # @return [ActionBuilder] A self reference1855 def key_action(*args, action: T.unsafe(nil), device: T.unsafe(nil)); end1856end1857module Selenium::WebDriver::Keys1858 class << self1859 # @api private1860 # @raise [Error::UnsupportedOperationError]1861 def [](key); end1862 # @api private1863 def encode(keys); end1864 # @api private1865 def encode_key(key); end1866 end1867end1868# @see Element#send_keys1869# @see http://www.google.com.au/search?&q=unicode+pua&btnK=Search1870Selenium::WebDriver::Keys::KEYS = T.let(T.unsafe(nil), Hash)1871class Selenium::WebDriver::Location < ::Struct1872 # Returns the value of attribute altitude1873 #1874 # @return [Object] the current value of altitude1875 def altitude; end1876 # Sets the attribute altitude1877 #1878 # @param value [Object] the value to set the attribute altitude to.1879 # @return [Object] the newly set value1880 def altitude=(_); end1881 # Returns the value of attribute latitude1882 #1883 # @return [Object] the current value of latitude1884 def latitude; end1885 # Sets the attribute latitude1886 #1887 # @param value [Object] the value to set the attribute latitude to.1888 # @return [Object] the newly set value1889 def latitude=(_); end1890 # Returns the value of attribute longitude1891 #1892 # @return [Object] the current value of longitude1893 def longitude; end1894 # Sets the attribute longitude1895 #1896 # @param value [Object] the value to set the attribute longitude to.1897 # @return [Object] the newly set value1898 def longitude=(_); end1899 class << self1900 def [](*_arg0); end1901 def inspect; end1902 def keyword_init?; end1903 def members; end1904 def new(*_arg0); end1905 end1906end1907class Selenium::WebDriver::LogEntry1908 # @return [LogEntry] a new instance of LogEntry1909 def initialize(level, timestamp, message); end1910 def as_json(*_arg0); end1911 # Returns the value of attribute level.1912 def level; end1913 # Returns the value of attribute message.1914 def message; end1915 def time; end1916 # Returns the value of attribute timestamp.1917 def timestamp; end1918 def to_s; end1919end1920# @example Enable full logging1921# Selenium::WebDriver.logger.level = :debug1922# @example Log to file1923# Selenium::WebDriver.logger.output = 'selenium.log'1924# @example Use logger manually1925# Selenium::WebDriver.logger.info('This is info message')1926# Selenium::WebDriver.logger.warn('This is warning message')1927class Selenium::WebDriver::Logger1928 extend ::Forwardable1929 # @param progname [String] Allow child projects to use Selenium's Logger pattern1930 # @return [Logger] a new instance of Logger1931 def initialize(progname = T.unsafe(nil)); end1932 def close(*args, **_arg1, &block); end1933 def debug(*args, **_arg1, &block); end1934 def debug?(*args, **_arg1, &block); end1935 # Marks code as deprecated with/without replacement.1936 #1937 # @param old [String]1938 # @param new [String, nil]1939 # @param id [Symbol, Array<Symbol>]1940 # @param reference [String]1941 # @yield appends additional message to end of provided template1942 def deprecate(old, new = T.unsafe(nil), id: T.unsafe(nil), reference: T.unsafe(nil), &block); end1943 def error(*args, **_arg1, &block); end1944 def error?(*args, **_arg1, &block); end1945 def fatal(*args, **_arg1, &block); end1946 def fatal?(*args, **_arg1, &block); end1947 # Will not log the provided ID.1948 #1949 # @param id [Array, Symbol]1950 def ignore(id); end1951 def info(*args, **_arg1, &block); end1952 def info?(*args, **_arg1, &block); end1953 # Returns IO object used by logger internally.1954 #1955 # Normally, we would have never needed it, but we want to1956 # use it as IO object for all child processes to ensure their1957 # output is redirected there.1958 #1959 # It is only used in debug level, in other cases output is suppressed.1960 #1961 # @api private1962 def io; end1963 def level(*args, **_arg1, &block); end1964 def level=(*args, **_arg1, &block); end1965 # Changes logger output to a new IO.1966 #1967 # @param io [String]1968 def output=(io); end1969 # Overrides default #warn to skip ignored messages by provided id1970 #1971 # @param message [String]1972 # @param id [Symbol, Array<Sybmol>]1973 # @yield see #deprecate1974 def warn(message, id: T.unsafe(nil)); end1975 def warn?(*args, **_arg1, &block); end1976 private1977 def create_logger(name); end1978 def default_level; end1979end1980class Selenium::WebDriver::Logs1981 # @api private1982 # @return [Logs] a new instance of Logs1983 def initialize(bridge); end1984 def available_types; end1985 def get(type); end1986end1987class Selenium::WebDriver::Manager1988 # @api private1989 # @return [Manager] a new instance of Manager1990 def initialize(bridge); end1991 # Add a cookie to the browser1992 #1993 # @option opts1994 # @option opts1995 # @option opts1996 # @option opts1997 # @option opts1998 # @option opts1999 # @param opts [Hash] the options to create a cookie with.2000 # @raise [ArgumentError] if :name or :value is not specified2001 def add_cookie(opts = T.unsafe(nil)); end2002 # Get all cookies2003 #2004 # @return [Array<Hash>] list of cookies2005 def all_cookies; end2006 # Get the cookie with the given name2007 #2008 # @param name [String] the name of the cookie2009 # @return [Hash, nil] the cookie, or nil if it wasn't found.2010 def cookie_named(name); end2011 # Delete all cookies2012 def delete_all_cookies; end2013 # Delete the cookie with the given name2014 #2015 # @param name [String] the name of the cookie to delete2016 def delete_cookie(name); end2017 def logs; end2018 # @param type [Symbol] Supports two values: :tab and :window.2019 # @return [String] The value of the window handle2020 def new_window(type = T.unsafe(nil)); end2021 def timeouts; end2022 def window; end2023 private2024 def convert_cookie(cookie); end2025 def datetime_at(int); end2026 def seconds_from(obj); end2027 def strip_port(str); end2028end2029Selenium::WebDriver::Manager::SECONDS_PER_DAY = T.let(T.unsafe(nil), Float)2030class Selenium::WebDriver::Navigation2031 # @return [Navigation] a new instance of Navigation2032 def initialize(bridge); end2033 # Move back a single entry in the browser's history.2034 def back; end2035 # Move forward a single entry in the browser's history.2036 def forward; end2037 # Refresh the current page.2038 def refresh; end2039 # Navigate to the given URL2040 def to(url); end2041end2042class Selenium::WebDriver::Options2043 # @return [Options] a new instance of Options2044 def initialize(options: T.unsafe(nil), **opts); end2045 def ==(other); end2046 # Add a new option not yet handled by bindings.2047 #2048 # @example Leave Chrome open when chromedriver is killed2049 # options = Selenium::WebDriver::Chrome::Options.new2050 # options.add_option(:detach, true)2051 # @param name [String, Symbol] Name of the option2052 # @param value [Boolean, String, Integer] Value of the option2053 def add_option(name, value = T.unsafe(nil)); end2054 # @api private2055 def as_json(*_arg0); end2056 def eql?(other); end2057 # Returns the value of attribute options.2058 def options; end2059 # Sets the attribute options2060 #2061 # @param value the value to set the attribute options to.2062 def options=(_arg0); end2063 private2064 def camel_case(str); end2065 # @return [Boolean]2066 def camelize?(_key); end2067 # @raise [TypeError]2068 def convert_json_key(key, camelize: T.unsafe(nil)); end2069 def generate_as_json(value, camelize_keys: T.unsafe(nil)); end2070 def process_browser_options(_browser_options); end2071 def process_json_hash(value, camelize_keys); end2072 def process_w3c_options(options); end2073 # @return [Boolean]2074 def w3c?(key); end2075 class << self2076 def chrome(**opts); end2077 # Returns the value of attribute driver_path.2078 def driver_path; end2079 def edge(**opts); end2080 def firefox(**opts); end2081 def ie(**opts); end2082 def internet_explorer(**opts); end2083 def microsoftedge(**opts); end2084 def safari(**opts); end2085 def set_capabilities; end2086 end2087end2088Selenium::WebDriver::Options::W3C_OPTIONS = T.let(T.unsafe(nil), Array)2089# @api private2090module Selenium::WebDriver::Platform2091 private2092 # @api private2093 def assert_executable(path); end2094 # @api private2095 def assert_file(path); end2096 # @api private2097 def bitsize; end2098 # @api private2099 def ci; end2100 # @api private2101 def cygwin?; end2102 # @api private2103 def cygwin_path(path, **opts); end2104 # @api private2105 def engine; end2106 # @api private2107 def exit_hook; end2108 # @api private2109 def find_binary(*binary_names); end2110 # @api private2111 def find_in_program_files(*binary_names); end2112 # @api private2113 def home; end2114 # @api private2115 def interfaces; end2116 # @api private2117 def ip; end2118 # @api private2119 def jruby?; end2120 # @api private2121 def linux?; end2122 # @api private2123 def localhost; end2124 # @api private2125 def mac?; end2126 # @api private2127 def make_writable(file); end2128 # @api private2129 def null_device; end2130 # @api private2131 def os; end2132 # @api private2133 def ruby_version; end2134 # @api private2135 def unix_path(path); end2136 # @api private2137 def windows?; end2138 # @api private2139 def windows_path(path); end2140 # @api private2141 def wrap_in_quotes_if_necessary(str); end2142 # @api private2143 def wsl?; end2144 class << self2145 # @api private2146 # @raise [Error::WebDriverError]2147 def assert_executable(path); end2148 # @api private2149 # @raise [Error::WebDriverError]2150 def assert_file(path); end2151 # @api private2152 def bitsize; end2153 # @api private2154 def ci; end2155 # @api private2156 # @return [Boolean]2157 def cygwin?; end2158 # @api private2159 def cygwin_path(path, **opts); end2160 # @api private2161 def engine; end2162 # @api private2163 def exit_hook; end2164 # @api private2165 def find_binary(*binary_names); end2166 # @api private2167 def find_in_program_files(*binary_names); end2168 # @api private2169 def home; end2170 # @api private2171 def interfaces; end2172 # @api private2173 def ip; end2174 # @api private2175 # @return [Boolean]2176 def jruby?; end2177 # @api private2178 # @return [Boolean]2179 def linux?; end2180 # @api private2181 # @raise [Error::WebDriverError]2182 def localhost; end2183 # @api private2184 # @return [Boolean]2185 def mac?; end2186 # @api private2187 def make_writable(file); end2188 # @api private2189 def null_device; end2190 # @api private2191 def os; end2192 # @api private2193 def ruby_version; end2194 # @api private2195 def unix_path(path); end2196 # @api private2197 # @return [Boolean]2198 def windows?; end2199 # @api private2200 def windows_path(path); end2201 # @api private2202 def wrap_in_quotes_if_necessary(str); end2203 # @api private2204 # @return [Boolean]2205 def wsl?; end2206 end2207end2208class Selenium::WebDriver::Point < ::Struct2209 # Returns the value of attribute x2210 #2211 # @return [Object] the current value of x2212 def x; end2213 # Sets the attribute x2214 #2215 # @param value [Object] the value to set the attribute x to.2216 # @return [Object] the newly set value2217 def x=(_); end2218 # Returns the value of attribute y2219 #2220 # @return [Object] the current value of y2221 def y; end2222 # Sets the attribute y2223 #2224 # @param value [Object] the value to set the attribute y to.2225 # @return [Object] the newly set value2226 def y=(_); end2227 class << self2228 def [](*_arg0); end2229 def inspect; end2230 def keyword_init?; end2231 def members; end2232 def new(*_arg0); end2233 end2234end2235module Selenium::WebDriver::PointerActions2236 # Clicks in the middle of the given element. Equivalent to:2237 #2238 # driver.action.move_to(element).click2239 #2240 # When no element is passed, the current mouse position will be clicked.2241 #2242 # @example Clicking on an element2243 #2244 # el = driver.find_element(id: "some_id")2245 # driver.action.click(el).perform2246 # @example Clicking at the current mouse position2247 #2248 # driver.action.click.perform2249 # @param element [Selenium::WebDriver::Element] An optional element to click.2250 # @param device [Symbol || String] optional name of the PointerInput device with the button2251 # that will be clicked2252 # @return [ActionBuilder] A self reference.2253 def click(element = T.unsafe(nil), device: T.unsafe(nil)); end2254 # Clicks (without releasing) in the middle of the given element. This is2255 # equivalent to:2256 #2257 # driver.action.move_to(element).click_and_hold2258 #2259 # @example Clicking and holding on some element2260 #2261 # el = driver.find_element(id: "some_id")2262 # driver.action.click_and_hold(el).perform2263 # @param element [Selenium::WebDriver::Element] the element to move to and click.2264 # @param device [Symbol || String] optional name of the PointerInput device to click with2265 # @return [ActionBuilder] A self reference.2266 def click_and_hold(element = T.unsafe(nil), device: T.unsafe(nil)); end2267 # Performs a context-click at middle of the given element. First performs2268 # a move_to to the location of the element.2269 #2270 # When no element is passed, the current mouse position will be context-clicked.2271 #2272 # @example Context-click at middle of given element2273 #2274 # el = driver.find_element(id: "some_id")2275 # driver.action.context_click(el).perform2276 # @example Context-clicking at the current mouse position2277 #2278 # driver.action.context_click.perform2279 # @param element [Selenium::WebDriver::Element] An element to context click.2280 # @param device [Symbol || String] optional name of the PointerInput device with the button2281 # that will be context-clicked2282 # @return [ActionBuilder] A self reference.2283 def context_click(element = T.unsafe(nil), device: T.unsafe(nil)); end2284 # The overridable duration for movement used by methods in this module2285 def default_move_duration; end2286 # Sets the attribute default_move_duration2287 #2288 # @param value the value to set the attribute default_move_duration to.2289 def default_move_duration=(_arg0); end2290 # Performs a double-click at middle of the given element. Equivalent to:2291 #2292 # driver.action.move_to(element).double_click2293 #2294 # When no element is passed, the current mouse position will be double-clicked.2295 #2296 # @example Double-click an element2297 #2298 # el = driver.find_element(id: "some_id")2299 # driver.action.double_click(el).perform2300 # @example Double-clicking at the current mouse position2301 #2302 # driver.action.double_click.perform2303 # @param element [Selenium::WebDriver::Element] An optional element to move to.2304 # @param device [Symbol || String] optional name of the PointerInput device with the button2305 # that will be double-clicked2306 # @return [ActionBuilder] A self reference.2307 def double_click(element = T.unsafe(nil), device: T.unsafe(nil)); end2308 # A convenience method that performs click-and-hold at the location of the2309 # source element, moves to the location of the target element, then2310 # releases the mouse.2311 #2312 # @example Drag and drop one element onto another2313 #2314 # el1 = driver.find_element(id: "some_id1")2315 # el2 = driver.find_element(id: "some_id2")2316 # driver.action.drag_and_drop(el1, el2).perform2317 # @param source [Selenium::WebDriver::Element] element to emulate button down at.2318 # @param target [Selenium::WebDriver::Element] element to move to and release the2319 # mouse at.2320 # @param device [Symbol || String] optional name of the PointerInput device with the button2321 # that will perform the drag and drop2322 # @return [ActionBuilder] A self reference.2323 def drag_and_drop(source, target, device: T.unsafe(nil)); end2324 # A convenience method that performs click-and-hold at the location of2325 # the source element, moves by a given offset, then releases the mouse.2326 #2327 # @example Drag and drop an element by offset2328 #2329 # el = driver.find_element(id: "some_id1")2330 # driver.action.drag_and_drop_by(el, 100, 100).perform2331 # @param source [Selenium::WebDriver::Element] Element to emulate button down at.2332 # @param right_by [Integer] horizontal move offset.2333 # @param down_by [Integer] vertical move offset.2334 # @param device [Symbol || String] optional name of the PointerInput device with the button2335 # that will perform the drag and drop2336 # @return [ActionBuilder] A self reference.2337 def drag_and_drop_by(source, right_by, down_by, device: T.unsafe(nil)); end2338 # Moves the mouse from its current position by the given offset.2339 # If the coordinates provided are outside the viewport (the mouse will2340 # end up outside the browser window) then the viewport is scrolled to2341 # match.2342 #2343 # @example Move the mouse to a certain offset from its current position2344 #2345 # driver.action.move_by(100, 100).perform2346 # @param right_by [Integer] horizontal offset. A negative value means moving the mouse left.2347 # @param down_by [Integer] vertical offset. A negative value means moving the mouse up.2348 # @param device [Symbol || String] optional name of the PointerInput device to move2349 # @raise [MoveTargetOutOfBoundsError] if the provided offset is outside the document's boundaries.2350 # @return [ActionBuilder] A self reference.2351 def move_by(right_by, down_by, device: T.unsafe(nil)); end2352 # Moves the mouse to the middle of the given element. The element is scrolled into2353 # view and its location is calculated using getBoundingClientRect. Then the2354 # mouse is moved to optional offset coordinates from the element.2355 #2356 # This is adapted to be backward compatible from non- actions. calculates offset from the center point2357 # of the element2358 #2359 # Note that when using offsets, both coordinates need to be passed.2360 #2361 # @example Scroll element into view and move the mouse to it2362 #2363 # el = driver.find_element(id: "some_id")2364 # driver.action.move_to(el).perform2365 # @example2366 #2367 # el = driver.find_element(id: "some_id")2368 # driver.action.move_to(el, 100, 100).perform2369 # @param element [Selenium::WebDriver::Element] to move to.2370 # @param right_by [Integer] Optional offset from the top-left corner. A negative value means2371 # coordinates to the left of the element.2372 # @param down_by [Integer] Optional offset from the top-left corner. A negative value means2373 # coordinates above the element.2374 # @param device [Symbol || String] optional name of the PointerInput device to move.2375 # @return [ActionBuilder] A self reference.2376 def move_to(element, right_by = T.unsafe(nil), down_by = T.unsafe(nil), device: T.unsafe(nil)); end2377 # Moves the mouse to a given location in the viewport.2378 # If the coordinates provided are outside the viewport (the mouse will2379 # end up outside the browser window) then the viewport is scrolled to2380 # match.2381 #2382 # @example Move the mouse to a certain position in the viewport2383 #2384 # driver.action.move_to_location(100, 100).perform2385 # @param x [Integer] horizontal position. Equivalent to a css 'left' value.2386 # @param y [Integer] vertical position. Equivalent to a css 'top' value.2387 # @param device [Symbol || String] optional name of the PointerInput device to move2388 # @raise [MoveTargetOutOfBoundsError] if the provided x or y value is outside the document's boundaries.2389 # @return [ActionBuilder] A self reference.2390 def move_to_location(x, y, device: T.unsafe(nil)); end2391 # Presses (without releasing) at the current location of the PointerInput device. This is equivalent to:2392 #2393 # driver.action.click_and_hold(nil)2394 #2395 # @example Clicking and holding at the current location2396 #2397 # driver.action.pointer_down(:left).perform2398 # @param button [Selenium::WebDriver::Interactions::PointerPress::BUTTONS] the button to press.2399 # @param device [Symbol || String] optional name of the PointerInput device with the button2400 # that will be pressed2401 # @return [ActionBuilder] A self reference.2402 def pointer_down(button, device: T.unsafe(nil)); end2403 # Releases the pressed mouse button at the current mouse location of the PointerInput device.2404 #2405 # @example Releasing a button after clicking and holding2406 #2407 # driver.action.pointer_down(:left).pointer_up(:left).perform2408 # @param button [Selenium::WebDriver::Interactions::PointerPress::BUTTONS] the button to release.2409 # @param device [Symbol || String] optional name of the PointerInput device with the button that will2410 # be released2411 # @return [ActionBuilder] A self reference.2412 def pointer_up(button, device: T.unsafe(nil)); end2413 # Releases the depressed left mouse button at the current mouse location.2414 #2415 # @example Releasing an element after clicking and holding it2416 #2417 # el = driver.find_element(id: "some_id")2418 # driver.action.click_and_hold(el).release.perform2419 # @param device [Symbol || String] optional name of the PointerInput device with the button2420 # that will be released2421 # @return [ActionBuilder] A self reference.2422 def release(device: T.unsafe(nil)); end2423 private2424 def button_action(button, action: T.unsafe(nil), device: T.unsafe(nil)); end2425 def get_pointer(device = T.unsafe(nil)); end2426end2427class Selenium::WebDriver::PortProber2428 class << self2429 def above(port); end2430 # @return [Boolean]2431 def free?(port); end2432 end2433end2434Selenium::WebDriver::PortProber::IGNORED_ERRORS = T.let(T.unsafe(nil), Array)2435# Common methods for Chrome::Profile and Firefox::Profile2436# Includers must implement #layout_on_disk2437#2438# @api private2439module Selenium::WebDriver::ProfileHelper2440 mixes_in_class_methods ::Selenium::WebDriver::ProfileHelper::ClassMethods2441 # @api private2442 def as_json(*_arg0); end2443 # @api private2444 def encoded; end2445 # @api private2446 def to_json(*_arg0); end2447 private2448 # @api private2449 def create_tmp_copy(directory); end2450 # @api private2451 # @raise [Errno::ENOENT]2452 def verify_model(model); end2453 class << self2454 # @api private2455 def decoded(json); end2456 # @api private2457 # @private2458 def included(base); end2459 end2460end2461# @api private2462module Selenium::WebDriver::ProfileHelper::ClassMethods2463 # @api private2464 def from_json(json); end2465end2466class Selenium::WebDriver::Proxy2467 # @raise [ArgumentError]2468 # @return [Proxy] a new instance of Proxy2469 def initialize(opts = T.unsafe(nil)); end2470 def ==(other); end2471 def as_json(*_arg0); end2472 def auto_detect; end2473 def auto_detect=(bool); end2474 def eql?(other); end2475 def ftp; end2476 def ftp=(value); end2477 def http; end2478 def http=(value); end2479 def no_proxy; end2480 def no_proxy=(value); end2481 def pac; end2482 def pac=(url); end2483 def socks; end2484 def socks=(value); end2485 def socks_password; end2486 def socks_password=(value); end2487 def socks_username; end2488 def socks_username=(value); end2489 def socks_version; end2490 def socks_version=(value); end2491 def ssl; end2492 def ssl=(value); end2493 def to_json(*_arg0); end2494 def type; end2495 def type=(type); end2496 class << self2497 def json_create(data); end2498 end2499end2500Selenium::WebDriver::Proxy::ALLOWED = T.let(T.unsafe(nil), Hash)2501Selenium::WebDriver::Proxy::TYPES = T.let(T.unsafe(nil), Hash)2502class Selenium::WebDriver::Rectangle < ::Struct2503 # Returns the value of attribute height2504 #2505 # @return [Object] the current value of height2506 def height; end2507 # Sets the attribute height2508 #2509 # @param value [Object] the value to set the attribute height to.2510 # @return [Object] the newly set value2511 def height=(_); end2512 # Returns the value of attribute width2513 #2514 # @return [Object] the current value of width2515 def width; end2516 # Sets the attribute width2517 #2518 # @param value [Object] the value to set the attribute width to.2519 # @return [Object] the newly set value2520 def width=(_); end2521 # Returns the value of attribute x2522 #2523 # @return [Object] the current value of x2524 def x; end2525 # Sets the attribute x2526 #2527 # @param value [Object] the value to set the attribute x to.2528 # @return [Object] the newly set value2529 def x=(_); end2530 # Returns the value of attribute y2531 #2532 # @return [Object] the current value of y2533 def y; end2534 # Sets the attribute y2535 #2536 # @param value [Object] the value to set the attribute y to.2537 # @return [Object] the newly set value2538 def y=(_); end2539 class << self2540 def [](*_arg0); end2541 def inspect; end2542 def keyword_init?; end2543 def members; end2544 def new(*_arg0); end2545 end2546end2547module Selenium::WebDriver::Remote; end2548# https://w3c.github.io/webdriver/#endpoints2549#2550# @api private2551class Selenium::WebDriver::Remote::Bridge2552 include ::Selenium::WebDriver::Atoms2553 # Initializes the bridge with the given server URL2554 #2555 # @api private2556 # @param :url [String, URI] url for the remote server2557 # @param :http_client [Object] an HTTP client instance that implements the same protocol as Http::Default2558 # @return [Bridge] a new instance of Bridge2559 def initialize(url:, http_client: T.unsafe(nil)); end2560 # alerts2561 def accept_alert; end2562 # actions2563 def action(async = T.unsafe(nil)); end2564 # actions2565 def actions(async = T.unsafe(nil)); end2566 # finding elements2567 def active_element; end2568 def add_cookie(cookie); end2569 def alert=(keys); end2570 def alert_text; end2571 def browser; end2572 # Returns the value of attribute capabilities.2573 def capabilities; end2574 def clear_element(element); end2575 def clear_local_storage; end2576 def clear_session_storage; end2577 def click_element(element); end2578 def close; end2579 def cookie(name); end2580 def cookies; end2581 # Creates session.2582 #2583 # @raise [Error::WebDriverError]2584 def create_session(capabilities); end2585 def delete_all_cookies; end2586 def delete_cookie(name); end2587 def dismiss_alert; end2588 def element_aria_label(element); end2589 def element_aria_role(element); end2590 def element_attribute(element, name); end2591 # @return [Boolean]2592 def element_displayed?(element); end2593 def element_dom_attribute(element, name); end2594 # @return [Boolean]2595 def element_enabled?(element); end2596 def element_location(element); end2597 def element_location_once_scrolled_into_view(element); end2598 def element_property(element, name); end2599 def element_rect(element); end2600 def element_screenshot(element); end2601 # @return [Boolean]2602 def element_selected?(element); end2603 def element_size(element); end2604 # element properties2605 def element_tag_name(element); end2606 def element_text(element); end2607 def element_value(element); end2608 def element_value_of_css_property(element, prop); end2609 def execute_async_script(script, *args); end2610 # javascript execution2611 def execute_script(script, *args); end2612 # Returns the value of attribute file_detector.2613 def file_detector; end2614 # Sets the attribute file_detector2615 #2616 # @param value the value to set the attribute file_detector to.2617 def file_detector=(_arg0); end2618 def find_element_by(how, what, parent_ref = T.unsafe(nil)); end2619 def find_elements_by(how, what, parent_ref = T.unsafe(nil)); end2620 def full_screen_window; end2621 def get(url); end2622 # navigation2623 def go_back; end2624 def go_forward; end2625 # Returns the value of attribute http.2626 def http; end2627 # Sets the attribute http2628 #2629 # @param value the value to set the attribute http to.2630 def http=(_arg0); end2631 # @raise [Error::UnsupportedOperationError]2632 def keyboard; end2633 # HTML 52634 def local_storage_item(key, value = T.unsafe(nil)); end2635 def local_storage_keys; end2636 def local_storage_size; end2637 # cookies2638 def manage; end2639 def maximize_window(handle = T.unsafe(nil)); end2640 def minimize_window; end2641 # @raise [Error::UnsupportedOperationError]2642 def mouse; end2643 # Create a new top-level browsing context2644 # https://w3c.github.io/webdriver/#new-window2645 #2646 # @param type [String] Supports two values: 'tab' and 'window'.2647 # Use 'tab' if you'd like the new window to share an OS-level window2648 # with the current browsing context.2649 # Use 'window' otherwise2650 # @return [Hash] Containing 'handle' with the value of the window handle2651 # and 'type' with the value of the created window type2652 def new_window(type); end2653 def page_source; end2654 def print_page(options = T.unsafe(nil)); end2655 def quit; end2656 def refresh; end2657 def release_actions; end2658 def remove_local_storage_item(key); end2659 def remove_session_storage_item(key); end2660 def reposition_window(x, y); end2661 # @raise [Error::WebDriverError]2662 def resize_window(width, height, handle = T.unsafe(nil)); end2663 def screenshot; end2664 def send_actions(data); end2665 def send_keys_to_element(element, keys); end2666 # Returns the current session ID.2667 def session_id; end2668 def session_storage_item(key, value = T.unsafe(nil)); end2669 def session_storage_keys; end2670 def session_storage_size; end2671 def set_window_rect(x: T.unsafe(nil), y: T.unsafe(nil), width: T.unsafe(nil), height: T.unsafe(nil)); end2672 def shadow_root(element); end2673 def status; end2674 def submit_element(element); end2675 # finding elements2676 def switch_to_active_element; end2677 def switch_to_default_content; end2678 def switch_to_frame(id); end2679 def switch_to_parent_frame; end2680 def switch_to_window(name); end2681 # timeouts2682 def timeouts; end2683 def timeouts=(timeouts); end2684 def title; end2685 def upload(local_file); end2686 def url; end2687 def window_handle; end2688 # window handling2689 def window_handles; end2690 def window_position; end2691 def window_rect; end2692 def window_size(handle = T.unsafe(nil)); end2693 private2694 def commands(command); end2695 def convert_locator(how, what); end2696 def element_id_from(id); end2697 # Escapes invalid characters in CSS selector.2698 #2699 # @see https://mathiasbynens.be/notes/css-escapes2700 def escape_css(string); end2701 def escaper; end2702 # executes a command on the remote server.2703 #2704 # @return [WebDriver::Remote::Response]2705 def execute(command, opts = T.unsafe(nil), command_hash = T.unsafe(nil)); end2706 def prepare_capabilities_payload(capabilities); end2707 def shadow_root_id_from(id); end2708 def unwrap_script_result(arg); end2709end2710# @api private2711Selenium::WebDriver::Remote::Bridge::COMMANDS = T.let(T.unsafe(nil), Hash)2712Selenium::WebDriver::Remote::Bridge::ESCAPE_CSS_REGEXP = T.let(T.unsafe(nil), Regexp)2713Selenium::WebDriver::Remote::Bridge::PORT = T.let(T.unsafe(nil), Integer)2714Selenium::WebDriver::Remote::Bridge::QUIT_ERRORS = T.let(T.unsafe(nil), Array)2715Selenium::WebDriver::Remote::Bridge::UNICODE_CODE_POINT = T.let(T.unsafe(nil), Integer)2716# Specification of the desired and/or actual capabilities of the browser that the2717# server is being asked to create.2718class Selenium::WebDriver::Remote::Capabilities2719 # @api public2720 # @option :browser_name2721 # @option :browser_version2722 # @option :platform_name2723 # @option :accept_insecure_certs2724 # @option :proxy2725 # @param opts [Hash]2726 # @param :browser_name [Hash] a customizable set of options2727 # @param :browser_version [Hash] a customizable set of options2728 # @param :platform_name [Hash] a customizable set of options2729 # @param :accept_insecure_certs [Hash] a customizable set of options2730 # @param :proxy [Hash] a customizable set of options2731 # @return [Capabilities] a new instance of Capabilities2732 def initialize(opts = T.unsafe(nil)); end2733 def ==(other); end2734 def [](key); end2735 # Allows setting arbitrary capabilities.2736 def []=(key, value); end2737 def accept_insecure_certs; end2738 def accept_insecure_certs=(value); end2739 # @api private2740 def as_json(*_arg0); end2741 def browser_name; end2742 def browser_name=(value); end2743 def browser_version; end2744 def browser_version=(value); end2745 def eql?(other); end2746 def implicit_timeout; end2747 def implicit_timeout=(timeout); end2748 def merge!(other); end2749 def page_load_strategy; end2750 def page_load_strategy=(value); end2751 def page_load_timeout; end2752 def page_load_timeout=(timeout); end2753 def platform; end2754 def platform=(value); end2755 def platform_name; end2756 def platform_name=(value); end2757 def proxy; end2758 def proxy=(proxy); end2759 def remote_session_id; end2760 def remote_session_id=(value); end2761 def script_timeout; end2762 def script_timeout=(timeout); end2763 def set_window_rect; end2764 def set_window_rect=(value); end2765 def strict_file_interactability; end2766 def strict_file_interactability=(value); end2767 def timeouts; end2768 def timeouts=(timeouts); end2769 def to_json(*_arg0); end2770 def unhandled_prompt_behavior; end2771 def unhandled_prompt_behavior=(value); end2772 # Backward compatibility2773 def version; end2774 def version=(value); end2775 def web_socket_url; end2776 def web_socket_url=(value); end2777 protected2778 # Returns the value of attribute capabilities.2779 def capabilities; end2780 private2781 def convert_key(key); end2782 def convert_value(key, value); end2783 def process_capabilities(key, value, hash); end2784 class << self2785 def always_match(capabilities); end2786 def camel_case(str_or_sym); end2787 def chrome(opts = T.unsafe(nil)); end2788 def edge(opts = T.unsafe(nil)); end2789 def ff(opts = T.unsafe(nil)); end2790 def firefox(opts = T.unsafe(nil)); end2791 def first_match(*capabilities); end2792 def htmlunit(opts = T.unsafe(nil)); end2793 def ie(opts = T.unsafe(nil)); end2794 def internet_explorer(opts = T.unsafe(nil)); end2795 # @api private2796 def json_create(data); end2797 def microsoftedge(opts = T.unsafe(nil)); end2798 def safari(opts = T.unsafe(nil)); end2799 private2800 def process_timeouts(caps, timeouts); end2801 end2802end2803Selenium::WebDriver::Remote::Capabilities::KNOWN = T.let(T.unsafe(nil), Array)2804# Driver implementation for remote server.2805#2806# @api private2807class Selenium::WebDriver::Remote::Driver < ::Selenium::WebDriver::Driver2808 include ::Selenium::WebDriver::DriverExtensions::UploadsFiles2809 include ::Selenium::WebDriver::DriverExtensions::HasSessionId2810 include ::Selenium::WebDriver::DriverExtensions::HasRemoteStatus2811 # @api private2812 # @return [Driver] a new instance of Driver2813 def initialize(bridge: T.unsafe(nil), listener: T.unsafe(nil), **opts); end2814 private2815 # @api private2816 def devtools_url; end2817 # @api private2818 def devtools_version; end2819end2820module Selenium::WebDriver::Remote::Http; end2821class Selenium::WebDriver::Remote::Http::Common2822 def call(verb, url, command_hash); end2823 def close; end2824 def quit_errors; end2825 # Sets the attribute server_url2826 #2827 # @param value the value to set the attribute server_url to.2828 def server_url=(_arg0); end2829 private2830 def create_response(code, body, content_type); end2831 # @raise [NotImplementedError]2832 def request(*_arg0); end2833 # @raise [Error::WebDriverError]2834 def server_url; end2835end2836Selenium::WebDriver::Remote::Http::Common::CONTENT_TYPE = T.let(T.unsafe(nil), String)2837Selenium::WebDriver::Remote::Http::Common::DEFAULT_HEADERS = T.let(T.unsafe(nil), Hash)2838# same as chromium/gecko2839Selenium::WebDriver::Remote::Http::Common::MAX_REDIRECTS = T.let(T.unsafe(nil), Integer)2840# @api private2841class Selenium::WebDriver::Remote::Http::Default < ::Selenium::WebDriver::Remote::Http::Common2842 # Initializes object.2843 # Warning: Setting {#open_timeout} to non-nil values will cause a separate thread to spawn.2844 # Debuggers that freeze the process will not be able to evaluate any operations if that happens.2845 #2846 # @api private2847 # @param open_timeout [Numeric] - Open timeout to apply to HTTP client.2848 # @param read_timeout [Numeric] - Read timeout (seconds) to apply to HTTP client.2849 # @return [Default] a new instance of Default2850 def initialize(open_timeout: T.unsafe(nil), read_timeout: T.unsafe(nil)); end2851 # @api private2852 def close; end2853 # @api private2854 def open_timeout; end2855 # @api private2856 def open_timeout=(_arg0); end2857 # @api private2858 def proxy=(_arg0); end2859 # @api private2860 def read_timeout; end2861 # @api private2862 def read_timeout=(_arg0); end2863 private2864 # @api private2865 def http; end2866 # @api private2867 def new_http_client; end2868 # @api private2869 def new_request_for(verb, url, headers, payload); end2870 # @api private2871 def proxy; end2872 # @api private2873 def request(verb, url, headers, payload, redirects = T.unsafe(nil)); end2874 # @api private2875 def response_for(request); end2876 # @api private2877 def start(http); end2878 # @api private2879 # @return [Boolean]2880 def use_proxy?; end2881end2882# @api private2883Selenium::WebDriver::Remote::Http::Default::MAX_RETRIES = T.let(T.unsafe(nil), Integer)2884# @api private2885class Selenium::WebDriver::Remote::Response2886 # @api private2887 # @return [Response] a new instance of Response2888 def initialize(code, payload = T.unsafe(nil)); end2889 # @api private2890 def [](key); end2891 # @api private2892 def code; end2893 # @api private2894 def error; end2895 # @api private2896 def payload; end2897 private2898 # @api private2899 def add_backtrace(ex, server_trace); end2900 # @api private2901 # @raise [Error::ServerError]2902 def assert_ok; end2903 # @api private2904 def backtrace_from_remote(server_trace); end2905 # @api private2906 def process_error; end2907end2908module Selenium::WebDriver::Safari2909 class << self2910 def driver_path; end2911 def driver_path=(path); end2912 # @raise [Error::WebDriverError]2913 def path; end2914 def path=(path); end2915 def technology_preview; end2916 def technology_preview!; end2917 # @return [Boolean]2918 def technology_preview?; end2919 # Returns the value of attribute use_technology_preview.2920 def use_technology_preview; end2921 # Sets the attribute use_technology_preview2922 #2923 # @param value the value to set the attribute use_technology_preview to.2924 def use_technology_preview=(_arg0); end2925 end2926end2927# Driver implementation for Safari.2928#2929# @api private2930class Selenium::WebDriver::Safari::Driver < ::Selenium::WebDriver::Driver2931 # @api private2932 def browser; end2933end2934# @api private2935Selenium::WebDriver::Safari::Driver::EXTENSIONS = T.let(T.unsafe(nil), Array)2936module Selenium::WebDriver::Safari::Features2937 def attach_debugger; end2938 def commands(command); end2939 def permissions; end2940 def permissions=(permissions); end2941end2942# https://developer.apple.com/library/content/documentation/NetworkingInternetWeb/Conceptual/WebDriverEndpointDoc/Commands/Commands.html2943Selenium::WebDriver::Safari::Features::SAFARI_COMMANDS = T.let(T.unsafe(nil), Hash)2944class Selenium::WebDriver::Safari::Options < ::Selenium::WebDriver::Options2945 # @raise [ArgumentError]2946 def add_option(name, value = T.unsafe(nil)); end2947 # Returns the value of attribute options.2948 def options; end2949 # Sets the attribute options2950 #2951 # @param value the value to set the attribute options to.2952 def options=(_arg0); end2953end2954Selenium::WebDriver::Safari::Options::BROWSER = T.let(T.unsafe(nil), String)2955# @see https://developer.apple.com/documentation/webkit/about_webdriver_for_safari2956Selenium::WebDriver::Safari::Options::CAPABILITIES = T.let(T.unsafe(nil), Hash)2957class Selenium::WebDriver::Safari::Service < ::Selenium::WebDriver::Service; end2958Selenium::WebDriver::Safari::Service::DEFAULT_PORT = T.let(T.unsafe(nil), Integer)2959Selenium::WebDriver::Safari::Service::EXECUTABLE = T.let(T.unsafe(nil), String)2960Selenium::WebDriver::Safari::Service::MISSING_TEXT = T.let(T.unsafe(nil), String)2961module Selenium::WebDriver::SearchContext2962 # Find the first element matching the given arguments2963 #2964 # When using Element#find_element with :xpath, be aware that webdriver2965 # follows standard conventions: a search prefixed with "//" will search2966 # the entire document, not just the children of this current node. Use2967 # ".//" to limit your search to the children of the receiving Element.2968 #2969 # @overload find_element2970 # @overload find_element2971 # @raise [Error::NoSuchElementError] if the element doesn't exist2972 # @return [Element]2973 def find_element(*args); end2974 # Find all elements matching the given arguments2975 #2976 # @see SearchContext#find_element2977 def find_elements(*args); end2978 private2979 def extract_args(args); end2980end2981# @api private2982Selenium::WebDriver::SearchContext::FINDERS = T.let(T.unsafe(nil), Hash)2983# Base class implementing default behavior of service object,2984# responsible for storing a service manager configuration.2985class Selenium::WebDriver::Service2986 # End users should use a class method for the desired driver, rather than using this directly.2987 #2988 # @api private2989 # @raise [Error::WebDriverError]2990 # @return [Service] a new instance of Service2991 def initialize(path: T.unsafe(nil), port: T.unsafe(nil), args: T.unsafe(nil)); end2992 # Returns the value of attribute executable_path.2993 def executable_path; end2994 # Returns the value of attribute extra_args.2995 def extra_args; end2996 # Returns the value of attribute host.2997 def host; end2998 # Sets the attribute host2999 #3000 # @param value the value to set the attribute host to.3001 def host=(_arg0); end3002 def launch; end3003 # Returns the value of attribute port.3004 def port; end3005 def shutdown_supported; end3006 protected3007 def extract_service_args(driver_opts); end3008 private3009 # @raise [Error::WebDriverError]3010 def binary_path(path = T.unsafe(nil)); end3011 class << self3012 def chrome(**opts); end3013 # Returns the value of attribute driver_path.3014 def driver_path; end3015 def driver_path=(path); end3016 def edge(**opts); end3017 def firefox(**opts); end3018 def ie(**opts); end3019 def internet_explorer(**opts); end3020 def microsoftedge(**opts); end3021 def safari(**opts); end3022 end3023end3024# Base class implementing default behavior of service_manager object,3025# responsible for starting and stopping driver implementations.3026#3027# @api private3028class Selenium::WebDriver::ServiceManager3029 # End users should use a class method for the desired driver, rather than using this directly.3030 #3031 # @api private3032 # @raise [Error::WebDriverError]3033 # @return [ServiceManager] a new instance of ServiceManager3034 def initialize(config); end3035 # @api private3036 def start; end3037 # @api private3038 def stop; end3039 # @api private3040 def uri; end3041 private3042 # @api private3043 def build_process(*command); end3044 # @api private3045 def cannot_connect_error_text; end3046 # @api private3047 def connect_to_server; end3048 # @api private3049 # @raise [Error::WebDriverError]3050 def connect_until_stable; end3051 # @api private3052 def find_free_port; end3053 # @api private3054 # @return [Boolean]3055 def process_exited?; end3056 # @api private3057 # @return [Boolean]3058 def process_running?; end3059 # @api private3060 def socket_lock; end3061 # @api private3062 def start_process; end3063 # @api private3064 def stop_process; end3065 # @api private3066 def stop_server; end3067end3068# @api private3069Selenium::WebDriver::ServiceManager::SOCKET_LOCK_TIMEOUT = T.let(T.unsafe(nil), Integer)3070# @api private3071Selenium::WebDriver::ServiceManager::START_TIMEOUT = T.let(T.unsafe(nil), Integer)3072# @api private3073Selenium::WebDriver::ServiceManager::STOP_TIMEOUT = T.let(T.unsafe(nil), Integer)3074class Selenium::WebDriver::ShadowRoot3075 include ::Selenium::WebDriver::SearchContext3076 # Creates a new shadow root3077 #3078 # @api private3079 # @return [ShadowRoot] a new instance of ShadowRoot3080 def initialize(bridge, id); end3081 def ==(other); end3082 # For Rails 3 - http://jonathanjulian.com/2010/04/rails-to_json-or-as_json/3083 #3084 # @api private3085 def as_json(*_arg0); end3086 def eql?(other); end3087 def hash; end3088 def inspect; end3089 # @api private3090 # @see SearchContext3091 def ref; end3092 # Convert to a ShadowRoot JSON Object for transmission over the wire.3093 #3094 # @api private3095 # @see https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#basic-terms-and-concepts3096 def to_json(*_arg0); end3097 private3098 # Returns the value of attribute bridge.3099 def bridge; end3100end3101Selenium::WebDriver::ShadowRoot::ROOT_KEY = T.let(T.unsafe(nil), String)3102# @api private3103class Selenium::WebDriver::SocketLock3104 # @api private3105 # @return [SocketLock] a new instance of SocketLock3106 def initialize(port, timeout); end3107 # Attempt to acquire a lock on the given port. Control is yielded to an3108 # execution block if the lock could be successfully obtained.3109 #3110 # @api private3111 def locked; end3112 private3113 # @api private3114 # @return [Boolean]3115 def can_lock?; end3116 # @api private3117 def current_time; end3118 # @api private3119 # @return [Boolean]3120 def did_lock?; end3121 # @api private3122 # @raise [Error::WebDriverError]3123 def lock; end3124 # @api private3125 def release; end3126end3127class Selenium::WebDriver::SocketPoller3128 # @return [SocketPoller] a new instance of SocketPoller3129 def initialize(host, port, timeout = T.unsafe(nil), interval = T.unsafe(nil)); end3130 # Returns true if the server has stopped listening within the given timeout,3131 # false otherwise.3132 #3133 # @return [Boolean]3134 def closed?; end3135 # Returns true if the server is listening within the given timeout,3136 # false otherwise.3137 #3138 # @return [Boolean]3139 def connected?; end3140 private3141 # @return [Boolean]3142 def conn_completed?(sock); end3143 def current_time; end3144 # we use a plain TCPSocket here since JRuby has issues closing socket3145 # see https://github.com/jruby/jruby/issues/57093146 #3147 # @return [Boolean]3148 def listening?; end3149 # @return [Boolean]3150 def socket_writable?(sock); end3151 def with_timeout; end3152end3153Selenium::WebDriver::SocketPoller::CONNECTED_ERRORS = T.let(T.unsafe(nil), Array)3154Selenium::WebDriver::SocketPoller::CONNECT_TIMEOUT = T.let(T.unsafe(nil), Integer)3155Selenium::WebDriver::SocketPoller::NOT_CONNECTED_ERRORS = T.let(T.unsafe(nil), Array)3156module Selenium::WebDriver::Support; end3157# Subclass and override methods from this class3158# to implement your own event listener.3159#3160# @example3161#3162# class NavigationListener < Selenium::WebDriver::Support::AbstractEventListener3163# def initialize(log)3164# @log = log3165# end3166#3167# def before_navigate_to(url, driver)3168# @log.info "navigating to #{url}"3169# end3170#3171# def after_navigate_to(url, driver)3172# @log.info "done navigating to #{url}"3173# end3174# end3175#3176# listener = NavigationListener.new(logger)3177# driver = Selenium::WebDriver.for :firefox, :listener => listener3178class Selenium::WebDriver::Support::AbstractEventListener3179 def after_change_value_of(element, driver); end3180 def after_click(element, driver); end3181 def after_close(driver); end3182 def after_execute_script(script, driver); end3183 def after_find(by, what, driver); end3184 def after_navigate_back(driver); end3185 def after_navigate_forward(driver); end3186 def after_navigate_to(url, driver); end3187 def after_quit(driver); end3188 def before_change_value_of(element, driver); end3189 def before_click(element, driver); end3190 def before_close(driver); end3191 def before_execute_script(script, driver); end3192 def before_find(by, what, driver); end3193 def before_navigate_back(driver); end3194 def before_navigate_forward(driver); end3195 def before_navigate_to(url, driver); end3196 def before_quit(driver); end3197end3198class Selenium::WebDriver::Support::BlockEventListener3199 # @return [BlockEventListener] a new instance of BlockEventListener3200 def initialize(callback); end3201 def method_missing(meth, *args); end3202end3203class Selenium::WebDriver::Support::Color3204 # @return [Color] a new instance of Color3205 def initialize(red, green, blue, alpha = T.unsafe(nil)); end3206 def ==(other); end3207 # Returns the value of attribute alpha.3208 def alpha; end3209 # Returns the value of attribute blue.3210 def blue; end3211 def eql?(other); end3212 # Returns the value of attribute green.3213 def green; end3214 def hash; end3215 def hex; end3216 # Returns the value of attribute red.3217 def red; end3218 def rgb; end3219 def rgba; end3220 class << self3221 def from_hsl(h, s, l, a); end3222 def from_string(str); end3223 def hue_to_rgb(lum1, lum2, hue); end3224 end3225end3226Selenium::WebDriver::Support::Color::HEX3_PATTERN = T.let(T.unsafe(nil), Regexp)3227Selenium::WebDriver::Support::Color::HEX_PATTERN = T.let(T.unsafe(nil), Regexp)3228Selenium::WebDriver::Support::Color::HSLA_PATTERN = T.let(T.unsafe(nil), Regexp)3229Selenium::WebDriver::Support::Color::HSL_PATTERN = T.let(T.unsafe(nil), Regexp)3230Selenium::WebDriver::Support::Color::RGBA_PATTERN = T.let(T.unsafe(nil), Regexp)3231Selenium::WebDriver::Support::Color::RGBA_PCT_PATTERN = T.let(T.unsafe(nil), Regexp)3232Selenium::WebDriver::Support::Color::RGB_PATTERN = T.let(T.unsafe(nil), Regexp)3233Selenium::WebDriver::Support::Color::RGB_PCT_PATTERN = T.let(T.unsafe(nil), Regexp)3234module Selenium::WebDriver::Support::Escaper3235 class << self3236 def escape(str); end3237 end3238end3239# @api private3240class Selenium::WebDriver::Support::EventFiringBridge3241 # @api private3242 # @return [EventFiringBridge] a new instance of EventFiringBridge3243 def initialize(delegate, listener); end3244 # @api private3245 def clear_element(ref); end3246 # @api private3247 def click_element(ref); end3248 # @api private3249 def close; end3250 # @api private3251 def execute_script(script, *args); end3252 # @api private3253 def find_element_by(how, what, parent = T.unsafe(nil)); end3254 # @api private3255 def find_elements_by(how, what, parent = T.unsafe(nil)); end3256 # @api private3257 def get(url); end3258 # @api private3259 def go_back; end3260 # @api private3261 def go_forward; end3262 # @api private3263 def quit; end3264 # @api private3265 def send_keys_to_element(ref, keys); end3266 private3267 # @api private3268 def create_element(ref); end3269 # @api private3270 def dispatch(name, *args); end3271 # @api private3272 def driver; end3273 # @api private3274 def method_missing(meth, *args, &blk); end3275end3276# @api private3277class Selenium::WebDriver::Support::RelativeLocator3278 # @api private3279 # @return [RelativeLocator] a new instance of RelativeLocator3280 def initialize(locator); end3281 # @api private3282 def as_json; end3283end3284# @api private3285Selenium::WebDriver::Support::RelativeLocator::KEYS = T.let(T.unsafe(nil), Array)3286class Selenium::WebDriver::Support::Select3287 # @param element [Element] The select element to use3288 # @raise [ArgumentError]3289 # @return [Select] a new instance of Select3290 def initialize(element); end3291 # Deselect all selected options. Only valid if the element supports multiple selections.3292 #3293 # @raise [Error::UnsupportedOperationError] if the element does not support multiple selections.3294 def deselect_all; end3295 # Deselect options by visible text, index or value.3296 #3297 # @param how [:text, :index, :value] How to find the option3298 # @param what [String] What value to find the option by.3299 # @raise [Error::UnsupportedOperationError] if the element does not support multiple selections.3300 # @see Select#select_by3301 def deselect_by(how, what); end3302 # Get the first selected option in this select element3303 #3304 # @raise [Error::NoSuchElementError] if no options are selected3305 # @return [Element]3306 def first_selected_option; end3307 # Does this select element support selecting multiple options?3308 #3309 # @return [Boolean]3310 def multiple?; end3311 # Get all options for this select element3312 #3313 # @return [Array<Element>]3314 def options; end3315 # Select all unselected options. Only valid if the element supports multiple selections.3316 #3317 # @raise [Error::UnsupportedOperationError] if the element does not support multiple selections.3318 def select_all; end3319 # Select options by visible text, index or value.3320 #3321 # When selecting by :text, selects options that display text matching the argument. That is, when given "Bar" this3322 # would select an option like:3323 #3324 # <option value="foo">Bar</option>3325 #3326 # When slecting by :value, selects all options that have a value matching the argument. That is, when given "foo" this3327 # would select an option like:3328 #3329 # <option value="foo">Bar</option>3330 #3331 # When selecting by :index, selects the option at the given index. This is done by examining the "index" attribute of an3332 # element, and not merely by counting.3333 #3334 # @param how [:text, :index, :value] How to find the option3335 # @param what [String] What value to find the option by.3336 def select_by(how, what); end3337 # Get all selected options for this select element3338 #3339 # @return [Array<Element>]3340 def selected_options; end3341 private3342 # @raise [Error::UnsupportedOperationError]3343 def deselect_by_index(index); end3344 # @raise [Error::UnsupportedOperationError]3345 def deselect_by_text(text); end...

Full Screen

Full Screen

program_scrapes_concern.rb

Source:program_scrapes_concern.rb Github

copy

Full Screen

...16 driver.get('https://tv.yahoo.co.jp/listings')17 # 番組表からurl一件ずつ取得18 @programs = []19 elements = driver.find_elements(:class, 'listingTablesTextLink')20 @urls = elements.map { |element| element.attribute('href') }21 @urls.first(15).each do |url|22 driver.navigate.to(url)23 sleep(rand(5))24 cur_url = driver.current_url25 p cur_url26 # 番組データを取得27 begin28 title = driver.find_element(:class, 'programRatingContentTitle').text29 rescue Selenium::WebDriver::Error::NoSuchElementError30 title = ''31 end32 begin33 second_title = driver.find_element(:class, 'programVideoContentTitleText').text34 rescue Selenium::WebDriver::Error::NoSuchElementError35 second_title = ''36 end37 begin38 talent = driver.find_element(:xpath, "//h3[contains(text(), '出演者')]/following-sibling::p[1]").text39 rescue Selenium::WebDriver::Error::NoSuchElementError40 talent = '※ 情報がありません'41 end42 begin43 channel = driver.find_element(:class, 'channelText').text44 rescue Selenium::WebDriver::Error::NoSuchElementError45 channel = ''46 end47 begin48 category = driver.find_element(:class, 'programOtherDataListText').text49 rescue Selenium::WebDriver::Error::NoSuchElementError50 category = ''51 end52 # 取得元のdatetimeの表記が12h制なのでdateとtimeを分けて取得 dateは属性値からdate情報のみ抽出、timeはtextから取得53 # start_datetime54 begin55 start_date = driver.find_element(:xpath,56 "//p[contains(text(), '放送日時・内容')]/following-sibling::div[1]/time[1]").attribute('datetime').slice(0..9)57 rescue Selenium::WebDriver::Error::NoSuchElementError58 start_date = ''59 end60 begin61 start_time = driver.find_element(:xpath,62 "//p[contains(text(), '放送日時・内容')]/following-sibling::div[1]//span[3]").text63 rescue Selenium::WebDriver::Error::NoSuchElementError64 start_time = ''65 end66 # end_datetime67 begin68 end_date = driver.find_element(:xpath,69 "//p[contains(text(), '放送日時・内容')]/following-sibling::div[1]/time[2]").attribute('datetime').slice(0..9)70 rescue Selenium::WebDriver::Error::NoSuchElementError71 end_date = ''72 end73 begin74 end_time = driver.find_element(:class, 'scheduleTextTimeEnd').text75 rescue Selenium::WebDriver::Error::NoSuchElementError76 end_time = ''77 end78 # 取得したdate、timeを結合、タイムゾーンをJSTに変更79 # 放送開始時間80 year, month, day = start_date.split('-').map(&:to_i)81 hour, minute = start_time.split(':').map(&:to_i)82 start_datetime = Time.zone.local(year, month, day, hour, minute)83 # 放送終了時間84 year, month, day = end_date.split('-').map(&:to_i)85 hour, minute = end_time.split(':').map(&:to_i)86 end_datetime = Time.zone.local(year, month, day, hour, minute)87 # 曜日取得88 by_weekday = start_datetime.wday89 @programs.push('title': title, 'second_title': second_title, 'talent': talent, 'channel': channel, 'category': category,90 'start_datetime': start_datetime, 'end_datetime': end_datetime, 'by_weekday': by_weekday)91 p title92 p start_datetime93 end94 # ドライバーを閉じる95 driver.quit96 # データをデータベースに保存97 @programs.each do |program|98 @program = Program.find_or_initialize_by(channel: program[:channel], start_datetime: program[:start_datetime])99 if @program.new_record?100 Program.create(program)101 else102 @program.update_columns(program)103 end104 STDOUT.flush105 end106 end107 # ====================================================================================================================108 # 3日後のデータ取得109 def threedays_later110 @wait_time = 3111 @timeout = 5112 # Seleniumの初期化113 # class ref: https://www.rubydoc.info/gems/selenium-webdriver/Selenium/WebDriver/Chrome114 Selenium::WebDriver.logger.output = File.join('./', 'selenium.log')115 Selenium::WebDriver.logger.level = :warn116 options = Selenium::WebDriver::Chrome::Options.new117 options.add_argument('--headless')118 driver = Selenium::WebDriver.for :chrome, options: options119 driver.manage.timeouts.implicit_wait = @timeout120 # ARGVで指定された日付後の番組を検索する121 # ARGV.each do | argv |122 # search_date = (Date.today + argv.to_i).strftime('%Y-%m-%d')123 # puts "search:" + search_date124 search_date = (Date.today + 3).strftime('%Y-%m-%d')125 # 番組表のページを開く126 driver.navigate.to('https://tv.yahoo.co.jp/search?t=3&g=&d=' + search_date + '&ob=&oc=%2B3000&dts=0&dtse=0&q=&a=&s=00')127 cur_url = driver.current_url128 p cur_url129 # 検索結果数130 sum = driver.find_element(:class, 'searchResultHeaderSumResultNumber').text.to_i131 p sum132 # ページ数分ループ133 (0..((sum / 10) + 1)).each do |page|134 options = Selenium::WebDriver::Chrome::Options.new135 options.add_argument('--headless')136 driver = Selenium::WebDriver.for :chrome, options: options137 driver.manage.timeouts.implicit_wait = @timeout138 # 該当の日時とページ数を代入しページを開く139 driver.navigate.to('https://tv.yahoo.co.jp/search?t=3&g=&d=' + search_date + '&ob=&oc=%2B3000&dts=0&dtse=0&q=&a=&s=' + page.to_s + '0')140 @programs = []141 elements = driver.find_elements(:class, 'programListItemTitleLink')142 @urls = elements.map { |element| element.attribute('href') }143 @urls.first(1).each do |url|144 driver.navigate.to(url)145 sleep(rand(5))146 cur_url = driver.current_url147 p cur_url148 # 番組データを取得149 begin150 title = driver.find_element(:class, 'programRatingContentTitle').text151 rescue Selenium::WebDriver::Error::NoSuchElementError152 title = ''153 end154 begin155 second_title = driver.find_element(:class, 'programVideoContentTitleText').text156 rescue Selenium::WebDriver::Error::NoSuchElementError157 second_title = ''158 end159 begin160 talent = driver.find_element(:xpath, "//h3[contains(text(), '出演者')]/following-sibling::p[1]").text161 rescue Selenium::WebDriver::Error::NoSuchElementError162 talent = '※ 情報がありません'163 end164 begin165 channel = driver.find_element(:class, 'channelText').text166 rescue Selenium::WebDriver::Error::NoSuchElementError167 channel = ''168 end169 begin170 category = driver.find_element(:class, 'programOtherDataListText').text171 rescue Selenium::WebDriver::Error::NoSuchElementError172 category = ''173 end174 # 取得元のdatetimeの表記が12h制なのでdateとtimeを分けて取得 dateは属性値からdate情報のみ抽出、timeはtextから取得175 # start_datetime176 begin177 start_date = driver.find_element(:xpath,178 "//p[contains(text(), '放送日時・内容')]/following-sibling::div[1]/time[1]").attribute('datetime').slice(0..9)179 rescue Selenium::WebDriver::Error::NoSuchElementError180 start_date = ''181 end182 begin183 start_time = driver.find_element(:xpath,184 "//p[contains(text(), '放送日時・内容')]/following-sibling::div[1]//span[3]").text185 rescue Selenium::WebDriver::Error::NoSuchElementError186 start_time = ''187 end188 # end_datetime189 begin190 end_date = driver.find_element(:xpath,191 "//p[contains(text(), '放送日時・内容')]/following-sibling::div[1]/time[2]").attribute('datetime').slice(0..9)192 rescue Selenium::WebDriver::Error::NoSuchElementError193 end_date = ''194 end195 begin196 end_time = driver.find_element(:class, 'scheduleTextTimeEnd').text197 rescue Selenium::WebDriver::Error::NoSuchElementError198 end_time = ''199 end200 sleep(rand(5))201 # 取得したdate、timeを結合、タイムゾーンをJSTに変更202 # 放送開始時間203 year, month, day = start_date.split('-').map(&:to_i)204 hour, minute = start_time.split(':').map(&:to_i)205 start_datetime = Time.zone.local(year, month, day, hour, minute)206 # 放送終了時間207 year, month, day = end_date.split('-').map(&:to_i)208 hour, minute = end_time.split(':').map(&:to_i)209 end_datetime = Time.zone.local(year, month, day, hour, minute)210 # 曜日取得211 by_weekday = start_datetime.wday212 @programs.push('title': title, 'second_title': second_title, 'talent': talent, 'channel': channel, 'category': category,213 'start_datetime': start_datetime, 'end_datetime': end_datetime, 'by_weekday': by_weekday)214 end215 # ドライバーを閉じる216 driver.quit217 # データをデータベースに保存218 @programs.each do |program|219 @program = Program.find_or_initialize_by(channel: program[:channel],220 start_datetime: program[:start_datetime])221 if @program.new_record?222 Program.create(program)223 else224 @program.update_columns(program)225 end226 STDOUT.flush227 end228 end229 end230 # ====================================================================================================================231 # 5日後のデータ取得232 def fivedays_later233 @wait_time = 3234 @timeout = 5235 # Seleniumの初期化236 # class ref: https://www.rubydoc.info/gems/selenium-webdriver/Selenium/WebDriver/Chrome237 Selenium::WebDriver.logger.output = File.join('./', 'selenium.log')238 Selenium::WebDriver.logger.level = :warn239 options = Selenium::WebDriver::Chrome::Options.new240 options.add_argument('--headless')241 driver = Selenium::WebDriver.for :chrome, options: options242 driver.manage.timeouts.implicit_wait = @timeout243 # ARGVで指定された日付後の番組を検索する244 # ARGV.each do | argv |245 # search_date = (Date.today + argv.to_i).strftime('%Y-%m-%d')246 # puts "search:" + search_date247 search_date = (Date.today + 5).strftime('%Y-%m-%d')248 # 番組表のページを開く249 driver.navigate.to('https://tv.yahoo.co.jp/search?t=3&g=&d=' + search_date + '&ob=&oc=%2B3000&dts=0&dtse=0&q=&a=&s=00')250 # 検索結果数251 sum = driver.find_element(:class, 'searchResultHeaderSumResultNumber').text.to_i252 # ページ数分ループ253 (0..((sum / 10) + 1)).each do |page|254 options = Selenium::WebDriver::Chrome::Options.new255 options.add_argument('--headless')256 driver = Selenium::WebDriver.for :chrome, options: options257 driver.manage.timeouts.implicit_wait = @timeout258 # 該当の日時とページ数を代入しページを開く259 driver.navigate.to('https://tv.yahoo.co.jp/search?t=3&g=&d=' + search_date + '&ob=&oc=%2B3000&dts=0&dtse=0&q=&a=&s=' + page.to_s + '0')260 @programs = []261 elements = driver.find_elements(:class, 'programListItemTitleLink')262 @urls = elements.map { |element| element.attribute('href') }263 @urls.first(1).each do |url|264 driver.navigate.to(url)265 sleep(rand(5))266 cur_url = driver.current_url267 p cur_url268 # 番組データを取得269 begin270 title = driver.find_element(:class, 'programRatingContentTitle').text271 rescue Selenium::WebDriver::Error::NoSuchElementError272 title = ''273 end274 begin275 second_title = driver.find_element(:class, 'programVideoContentTitleText').text276 rescue Selenium::WebDriver::Error::NoSuchElementError277 second_title = ''278 end279 begin280 talent = driver.find_element(:xpath, "//h3[contains(text(), '出演者')]/following-sibling::p[1]").text281 rescue Selenium::WebDriver::Error::NoSuchElementError282 talent = '※ 情報がありません'283 end284 begin285 channel = driver.find_element(:class, 'channelText').text286 rescue Selenium::WebDriver::Error::NoSuchElementError287 channel = ''288 end289 begin290 category = driver.find_element(:class, 'programOtherDataListText').text291 rescue Selenium::WebDriver::Error::NoSuchElementError292 category = ''293 end294 # 取得元のdatetimeの表記が12h制なのでdateとtimeを分けて取得 dateは属性値からdate情報のみ抽出、timeはtextから取得295 # start_datetime296 begin297 start_date = driver.find_element(:xpath,298 "//p[contains(text(), '放送日時・内容')]/following-sibling::div[1]/time[1]").attribute('datetime').slice(0..9)299 rescue Selenium::WebDriver::Error::NoSuchElementError300 start_date = ''301 end302 begin303 start_time = driver.find_element(:xpath,304 "//p[contains(text(), '放送日時・内容')]/following-sibling::div[1]//span[3]").text305 rescue Selenium::WebDriver::Error::NoSuchElementError306 start_time = ''307 end308 # end_datetime309 begin310 end_date = driver.find_element(:xpath,311 "//p[contains(text(), '放送日時・内容')]/following-sibling::div[1]/time[2]").attribute('datetime').slice(0..9)312 rescue Selenium::WebDriver::Error::NoSuchElementError313 end_date = ''314 end315 begin316 end_time = driver.find_element(:class, 'scheduleTextTimeEnd').text317 rescue Selenium::WebDriver::Error::NoSuchElementError318 end_time = ''319 end320 sleep(rand(5))321 # 取得したdate、timeを結合、タイムゾーンをJSTに変更322 # 放送開始時間323 year, month, day = start_date.split('-').map(&:to_i)324 hour, minute = start_time.split(':').map(&:to_i)325 start_datetime = Time.zone.local(year, month, day, hour, minute)...

Full Screen

Full Screen

vamp_spec.rb

Source:vamp_spec.rb Github

copy

Full Screen

...20 wait.until { driver.find_elements(:xpath, "//div[@class='catogory']") }21 driver22 .find_element(:css, "ul.sidebar-nav")23 .find_elements(:tag_name, "li")24 .select { |i| i.attribute("class") != 'has-sub-menu' }25 .select { |i| i.attribute("class") != 'sub-menu-item' }26 .select { |i| i.text.downcase == 'blueprints' }27 .each { |i|28 i.find_element(:tag_name, "a").click()29 if do_screenshots30 driver.save_screenshot("screen_" + c.to_s + ".png")31 c = c + 132 end33 button = driver34 .find_elements(:xpath, "//div[@class='row content-header']//button")35 .select { |j| j.text == 'Docker Compose' }36 .first37 button.click()38 sleep 139 if do_screenshots40 driver.save_screenshot("screen_" + c.to_s + ".png")41 c = c + 142 end43 expect(driver.find_element(:xpath, "//div[@class='modal-content']").displayed?).to eq(true)44 }45 button = driver46 .find_elements(:xpath, "//div[@class='modal-content']//button")47 .select { |j| j.text == 'Cancel' }48 .first49 button.click()50 if do_screenshots51 driver.save_screenshot("screen_" + c.to_s + ".png")52 c = c + 153 end54 button = driver55 .find_elements(:xpath, "//div[@class='row content-header']//button")56 .select { |j| j.text == 'Add' }57 .first58 if do_screenshots59 driver.save_screenshot("screen_" + c.to_s + ".png")60 c = c + 161 end62 expect(button.displayed?).to eq(true)63 driver.quit64 end65end66RSpec.describe "basic checks on top menu items" do67 it "68 - header text should be the equal to a button text69 - editor should be displayed70 - editor should be closed71 " do72 wait = Selenium::WebDriver::Wait.new(timeout: 15)73 driver = Selenium::WebDriver.for driver_name, options: driver_options74 driver.manage.window.size = Selenium::WebDriver::Dimension.new(1920, 1080)75 driver.navigate.to url76 wait.until { driver.find_elements(:xpath, "//div[@class='catogory']") }77 driver78 .find_element(:css, "ul.sidebar-nav")79 .find_elements(:tag_name, "li")80 .select { |i| i.attribute("class") != 'has-sub-menu' }81 .select { |i| i.attribute("class") != 'sub-menu-item' }82 .select { |i| i.text.downcase != 'collapse menu' }83 .each { |i|84 i.click()85 wait.until { driver.find_element(:css, "div.header-content") }86 if do_screenshots87 driver.save_screenshot("screen_" + c.to_s + ".png")88 c = c + 189 end90 expect(driver.find_element(:css, "div.header-content").text.downcase).to eq(i.text.downcase)91 expect(driver.current_url).to eq(url.downcase + i.attribute("href"))92 button = driver93 .find_elements(:xpath, "//div[@class='row content-header']//button")94 .select { |j| j.text == 'Add' }95 .first96 next_url = driver.current_url + "/" + button.text.downcase97 button.click()98 wait.until { driver.find_elements(:xpath, "//div[@class='editor-buttons clearfix']//button") }99 if do_screenshots100 driver.save_screenshot("screen_" + c.to_s + ".png")101 c = c + 1102 end103 expect(driver.find_element(:xpath, "//div[@id='editor']").displayed?).to eq(true)104 expect(driver.current_url).to eq(next_url)105 button = driver106 .find_elements(:xpath, "//div[@class='editor-buttons clearfix']//button")107 .first108 next_url = driver.current_url.split("/")[0..-2].join("/")109 button.click()110 wait.until { driver.find_elements(:xpath, "//div[@class='row content-header']//button") }111 if do_screenshots112 driver.save_screenshot("screen_" + c.to_s + ".png")113 c = c + 1114 end115 button = driver116 .find_elements(:xpath, "//div[@class='row content-header']//button")117 .select { |j| j.text == 'Add' }118 .first119 if do_screenshots120 driver.save_screenshot("screen_" + c.to_s + ".png")121 c = c + 1122 end123 expect(button.displayed?).to eq(true)124 expect(driver.current_url).to eq(next_url)125 }126 driver.quit127 end128end129RSpec.describe "basic checks on sub menu items" do130 it "- header text should be the equal to a button text" do131 wait = Selenium::WebDriver::Wait.new(timeout: 15)132 driver = Selenium::WebDriver.for driver_name, options: driver_options133 driver.manage.window.size = Selenium::WebDriver::Dimension.new(1920, 1080)134 driver.navigate.to url135 wait.until { driver.find_elements(:xpath, "//div[@class='catogory']") }136 driver137 .find_elements(:xpath, "//a[@class='btn-link collapse-btn']")138 .first139 .click()140 wait.until { driver.find_elements(:xpath, "//span[@class='icon-label hidden-xs']") }141 driver142 .find_element(:css, "ul.sidebar-nav")143 .find_elements(:xpath, "//li[@class='has-sub-menu']")144 .select{ |i| i.attribute("href") == nil }145 .each { |i|146 i.find_element(:tag_name, "a").click()147 wait.until { driver.find_elements(:xpath, "//a[@class='capitalize']") }148 if do_screenshots149 driver.save_screenshot("screen_" + c.to_s + ".png")150 c = c + 1151 end152 expect(driver.find_element(:css, "ul.sub-menu").displayed?).to eq(true)153 break154 }155 driver156 .find_element(:css, "ul.sidebar-nav")157 .find_elements(:xpath, "//li[@class='sub-menu-item']")158 .each { |i|159 i.click()160 wait.until { driver.find_elements(:xpath, "//div[@class='container-fluid main-view']") }161 if do_screenshots162 driver.save_screenshot("screen_" + c.to_s + ".png")163 c = c + 1164 end165 expect(driver.find_element(:css, "div.header-content").text.downcase).to eq(i.text.downcase)166 expect(driver.current_url).to eq(url.downcase + i.attribute("href"))167 }168 driver.quit169 end170end171RSpec.describe "test each tab in backend configuration" do172 it "- tab content should be displayed" do173 wait = Selenium::WebDriver::Wait.new(timeout: 15)174 driver = Selenium::WebDriver.for driver_name, options: driver_options175 driver.manage.window.size = Selenium::WebDriver::Dimension.new(1920, 1080)176 driver.navigate.to url177 wait.until { driver.find_elements(:xpath, "//div[@class='catogory']") }178 driver179 .find_elements(:xpath, "//a[@class='btn-link collapse-btn']")180 .first181 .click()182 wait.until { driver.find_elements(:xpath, "//span[@class='icon-label hidden-xs']") }183 driver184 .find_element(:css, "ul.sidebar-nav")185 .find_elements(:xpath, "//li[@class='has-sub-menu']")186 .select{ |i| i.attribute("href") == nil }187 .each { |i|188 i.find_element(:tag_name, "a").click()189 if do_screenshots190 driver.save_screenshot("screen_" + c.to_s + ".png")191 c = c + 1192 end193 expect(driver.find_element(:css, "ul.sub-menu").displayed?).to eq(true)194 }195 driver196 .find_element(:css, "ul.sidebar-nav")197 .find_elements(:xpath, "//li[@class='sub-menu-item']")198 .select { |i| i.text.downcase == 'backend configuration' }199 .each { |i|200 i.click()201 wait.until { driver.find_element(:css, "div.header-content") }202 if do_screenshots203 driver.save_screenshot("screen_" + c.to_s + ".png")204 c = c + 1205 end206 driver207 .find_elements(:xpath, "//ul[@class='nav nav-tabs']//li")208 .each { |j|209 j.click()210 wait.until { driver.find_elements(:xpath, "//dev[@class='nav nav-tabs']//li[@class='active']") }211 if do_screenshots212 driver.save_screenshot("screen_" + c.to_s + ".png")213 c = c + 1214 end215 expect(driver.find_element(:css, "div.tab-content").displayed?).to eq(true)216 }217 }218 driver.quit219 end220end221RSpec.describe "test each tab in vga configuration" do222 it "- tab content should be displayed" do223 wait = Selenium::WebDriver::Wait.new(timeout: 15)224 driver = Selenium::WebDriver.for driver_name, options: driver_options225 driver.manage.window.size = Selenium::WebDriver::Dimension.new(1920, 1080)226 driver.navigate.to url227 wait.until { driver.find_elements(:xpath, "//div[@class='catogory']") }228 driver229 .find_elements(:xpath, "//a[@class='btn-link collapse-btn']")230 .first231 .click()232 wait.until { driver.find_elements(:xpath, "//span[@class='icon-label hidden-xs']") }233 driver234 .find_element(:css, "ul.sidebar-nav")235 .find_elements(:xpath, "//li[@class='has-sub-menu']")236 .select{ |i| i.attribute("href") == nil }237 .each { |i|238 i.find_element(:tag_name, "a").click()239 if do_screenshots240 driver.save_screenshot("screen_" + c.to_s + ".png")241 c = c + 1242 end243 expect(driver.find_element(:css, "ul.sub-menu").displayed?).to eq(true)244 }245 driver246 .find_element(:css, "ul.sidebar-nav")247 .find_elements(:xpath, "//li[@class='sub-menu-item']")248 .select { |i| i.text.downcase == 'vga configuration' }249 .each { |i|250 i.click()251 if do_screenshots252 driver.save_screenshot("screen_" + c.to_s + ".png")253 c = c + 1254 end255 driver256 .find_elements(:xpath, "//ul[@class='nav nav-tabs']//li")257 .each { |j|258 j.click()259 wait.until { driver.find_elements(:xpath, "//dev[@class='nav nav-tabs']//li[@class='active']") }260 if do_screenshots261 driver.save_screenshot("screen_" + c.to_s + ".png")262 c = c + 1263 end264 expect(driver.find_element(:css, "div.tab-content").displayed?).to eq(true)265 }266 }267 driver.quit268 end269end270RSpec.describe "test editor in extended info" do271 it "- editor should be displayed" do272 wait = Selenium::WebDriver::Wait.new(timeout: 15)273 driver = Selenium::WebDriver.for driver_name, options: driver_options274 driver.manage.window.size = Selenium::WebDriver::Dimension.new(1920, 1080)275 driver.navigate.to url276 wait.until { driver.find_elements(:xpath, "//div[@class='catogory']") }277 driver278 .find_elements(:xpath, "//a[@class='btn-link collapse-btn']")279 .first280 .click()281 wait.until { driver.find_elements(:xpath, "//span[@class='icon-label hidden-xs']") }282 driver283 .find_element(:css, "ul.sidebar-nav")284 .find_elements(:xpath, "//li[@class='has-sub-menu']")285 .select{ |i| i.attribute("href") == nil }286 .each { |i|287 i.find_element(:tag_name, "a").click()288 if do_screenshots289 driver.save_screenshot("screen_" + c.to_s + ".png")290 c = c + 1291 end292 expect(driver.find_element(:css, "ul.sub-menu").displayed?).to eq(true)293 }294 driver295 .find_element(:css, "ul.sidebar-nav")296 .find_elements(:xpath, "//li[@class='sub-menu-item']")297 .select { |i| i.text.downcase == 'extended info' }298 .each { |i|299 i.click()300 sleep 1301 if do_screenshots302 driver.save_screenshot("screen_" + c.to_s + ".png")303 c = c + 1304 end305 expect(driver.find_element(:xpath, "//div[@id='editor']").displayed?).to eq(true)306 }307 driver.quit308 end309end310RSpec.describe "test panels in log" do311 it "- panels should be displayed" do312 wait = Selenium::WebDriver::Wait.new(timeout: 15)313 driver = Selenium::WebDriver.for driver_name, options: driver_options314 driver.manage.window.size = Selenium::WebDriver::Dimension.new(1920, 1080)315 driver.navigate.to url316 wait.until { driver.find_elements(:xpath, "//div[@class='catogory']") }317 driver318 .find_elements(:xpath, "//a[@class='btn-link collapse-btn']")319 .first320 .click()321 wait.until { driver.find_elements(:xpath, "//span[@class='icon-label hidden-xs']") }322 driver323 .find_element(:css, "ul.sidebar-nav")324 .find_elements(:xpath, "//li[@class='has-sub-menu']")325 .select{ |i| i.attribute("href") == nil }326 .each { |i|327 i.find_element(:tag_name, "a").click()328 if do_screenshots329 driver.save_screenshot("screen_" + c.to_s + ".png")330 c = c + 1331 end332 expect(driver.find_element(:css, "ul.sub-menu").displayed?).to eq(true)333 }334 driver335 .find_element(:css, "ul.sidebar-nav")336 .find_elements(:xpath, "//li[@class='sub-menu-item']")337 .select { |i| i.text.downcase == 'log' }338 .each { |i|339 i.click()...

Full Screen

Full Screen

all_steps.rb

Source:all_steps.rb Github

copy

Full Screen

...9 begin10 a=@driver.find_element(:name,'realmId') #realmId should be the html tag name of select tag11 options=a.find_elements(:tag_name=>"option") # all the options of that select tag will be selected12 options.each do |g|13 if g.attribute('value') == text || g.text == text14 g.click15 break16 end17 end18 ele=@driver.find_element(:id, "go")19 ele.click20 rescue21 if @driver.page_source.match('SLI Exception')22 ele=false23 puts "SLI Exception"24 elsif Timeout::Error25 puts "TimeOut error"26 else27 raise Selenium::WebDriver::Error::NoSuchElementError28 end29 end30 31end32Then /^I follow all the wsrp links$/ do33 begin34 wsrp_elements= []35 # wsrp_elements=@driver.find_elements(:xpath, "//section [@id='portlet_appselectioninterfaceportlet_WAR_AppSelectionInterfaceportlet']/div/div/div/table/tbody/tr/td/a")36 @driver.find_elements(:xpath, "//a[@href='#']").each do |tt|37 if tt.attribute('onclick') != nil && tt.attribute('onclick').match('callWsrp')38 wsrp_elements << tt39 end40 end41 wsrp_elements.compact!42 wsrp_ele=[]43 wsrp_elements.each do |wsrp|44 wsrp_ele << wsrp.attribute('onclick').gsub("callWsrp","").gsub("(","").gsub(")","").gsub("'","")45 end46 47 wsrp_ele.each do |el|48 @driver.navigate.to el49 puts "successfully open all the #{el} WSRP Page"50 end51 52 53 54 rescue55 if @driver.page_source.match('SLI Exception')56 ele=false57 puts "SLI Exception"58 elsif Timeout::Error59 puts "TimeOut error"60 else61 raise Selenium::WebDriver::Error::NoSuchElementError62 end63 end64 65end66Then /^I am on the wsrp page$/ do67 begin68 text=@driver.find_element(:tag_name => "title").text()69 puts text70 rescue71 if @driver.page_source.match('SLI Exception')72 ele=false73 puts "SLI Exception"74 elsif Timeout::Error75 puts "TimeOut error"76 else77 raise Selenium::WebDriver::Error::NoSuchElementError78 end79 end80end81Then /^I select "([^\"]*)" from "([^\"]*)"$/ do |text,field|82 begin83 #wait = Selenium::WebDriver::Wait.new(:timeout => 10)84 # wait.until{85 a=@driver.find_element(:id, field)86 options=a.find_elements(:tag_name=>"option")87 options.each do |g|88 if g.attribute('value') == text || g.text == text89 g.click90 break91 end92 end93 # }94 rescue95 if @driver.page_source.match('SLI Exception')96 ele=false97 puts "SLI Exception"98 elsif Timeout::Error99 puts "TimeOut error"100 else101 raise Selenium::WebDriver::Error::NoSuchElementError102 end103 end104end105Then /^I click "([^\"]*)"$/ do |btn_text|106 begin107 ele=@driver.find_element(:id, "go")108 ele.click109 rescue110 if @driver.page_source.match('SLI Exception')111 ele=false112 puts "SLI Exception"113 elsif Timeout::Error114 puts "TimeOut error"115 else116 raise Selenium::WebDriver::Error::NoSuchElementError117 end118 end119 #@driver.find_element(:xpath, "//form/input[@value=#{btn_text}]").click120end 121Given /^EULA has been accepted$/ do122end123When /^I go to the login page$/ do124 @driver.navigate.to "https://devlycans.slidev.org/portal"125 begin126 a=@driver.find_element(:name,'realmId') #realmId should be the html tag name of select tag127 ele=true128 if ele == true129 options=a.find_elements(:tag_name=>"option") # all the options of that select tag will be selected130 options.each do |g|131 if g.attribute('value') == '5a4bfe96-1724-4565-9db1-35b3796e3ce1'132 g.click133 break134 end135 end136 ele=@driver.find_element(:id, "go")137 ele.click138 end139 rescue140 if @driver.page_source.match('SLI Exception')141 ele=false142 puts "SLI Exception"143 elsif Timeout::Error144 puts "TimeOut error"145 else146 raise Selenium::WebDriver::Error::NoSuchElementError147 end148 end149 150 151end152Then /^I follow the home page Dashboard$/ do 153 begin154 element= @driver.find_element(:xpath, "//td/a/div[text()=' Dashboard (Integration)']")155 element.click156 rescue157 if @driver.page_source.match('SLI Exception')158 ele=false159 puts "SLI Exception"160 elsif Timeout::Error161 puts "TimeOut error"162 else163 raise Selenium::WebDriver::Error::NoSuchElementError164 end165 end166end167Then /^I should logged out$/ do168 #begin169 #@driver.find_element(:link, 'Sign Out').click170 #rescue171 begin172 173 174 #action=Selenium::WebDriver::ActionBuilder.new(:move_to,nil)175 wait = Selenium::WebDriver::Wait.new(:timeout => 10) 176 wait.until{177 menu = @driver.find_elements(:class,"menulink").first.click()178 submenu=@driver.find_element(:link, 'Logout')179 submenu.click }180 #@driver.action.move_to(menu).perform181 rescue182 183 if @driver.page_source.match('SLI Exception')184 ele=false185 puts "SLI Exception"186 elsif Timeout::Error187 puts "TimeOut error"188 else189 raise Selenium::WebDriver::Error::NoSuchElementError190 end191 192 end193 #submenu=@driver.find_element(:link, 'Logout')194 195 #@driver.action.move_to(menu).click(submenu).perform196 197 #click_link('Logout')198end199Then /^I should be on the home page$/ do200 begin201 ele=@driver.find_element(:xpath, "//input[@value='Agree']")202 element=true203 rescue204 element=false205 end206 if element207 ele.click208 else209 puts "EULA has already been accepted"210 end211 begin212 213 #action=Selenium::WebDriver::ActionBuilder.new(:move_to,nil)214 #@driver.action.move_to(menu).perform215 wait = Selenium::WebDriver::Wait.new(:timeout => 10) 216 wait.until{217 menu = @driver.find_elements(:class,"menulink").first.click()218 submenu=@driver.find_element(:link, 'Logout').displayed? }219 rescue Selenium::WebDriver::Error::NoSuchElementError, Timeout::Error, NoMethodError220 if @driver.page_source.match('SLI Exception')221 ele=false222 puts "SLI Exception"223 elsif Timeout::Error224 puts "TimeOut error"225 elsif NoMethodError226 puts ""227 else228 raise Selenium::WebDriver::Error::NoSuchElementError229 end230 end231 #submenu=@driver.find_element(:link, 'Logout').displayed?232 233 234 #@driver.find_element(:link, 'Sign Out').displayed?235end236And /^I see the EULA Page$/ do237 begin238 ele=@driver.find_element(:xpath, "//input[@value='Agree']")239 ele2=@driver.find_element(:xpath, "//input[@value='Logout']")240 element=true241 rescue242 element=false243 end244 if element == true245 true246 else247 puts "SLI Exception"248 end 249end250When /^I mouseover on menu and click submenu "([^\"]*)"$/ do |submenu|251 begin252 253 #action=Selenium::WebDriver::ActionBuilder.new(:move_to,nil)254 #@driver.action.move_to(menu).perform255 wait = Selenium::WebDriver::Wait.new(:timeout => 10)256 wait.until{257 menu = @driver.find_elements(:class,"menulink").first.click()258 @driver.find_element(:link, submenu).click()}259 rescue260 if @driver.page_source.match('SLI Exception')261 ele=false262 puts "SLI Exception"263 elsif Timeout::Error264 puts "TimeOut error"265 else266 raise Selenium::WebDriver::Error::NoSuchElementError267 end268 end269 #submenu=@driver.find_element(:link, 'Logout')270 # submenu.click271 272end273Given /^I should remove all cookies$/ do274 @driver.manage.delete_all_cookies275end276When /^I login with "([^\"]*)" and "([^\"]*)"$/ do |username, password|277 begin278 @driver.manage.delete_all_cookies279 element = @driver.find_element(:id, 'IDToken1') #the username field id is IDToken1280 element.send_keys username281 element = @driver.find_element(:id, 'IDToken2') #the username field id is IDToken2282 element.send_keys password283 element=@driver.find_element(:class, "Btn1Def")284 element.click285 rescue286 if @driver.page_source.match('SLI Exception')287 ele=false288 puts "SLI Exception"289 elsif Timeout::Error290 puts "TimeOut error"291 else292 raise Selenium::WebDriver::Error::NoSuchElementError293 end294 end295 #wait = Selenium::WebDriver::Wait.new(:timeout => 100) # seconds296 # wait.until { driver.find_element(:link => "Logout") }297end298Then /^I should be on the authentication failed page$/ do299 begin300 @driver.navigate.to "https://devopenam1.slidev.org:80/idp2/UI/Login"301 rescue302 303 if @driver.page_source.match('SLI Exception')304 ele=false305 puts "SLI Exception"306 elsif Timeout::Error307 puts "TimeOut error"308 else309 raise Selenium::WebDriver::Error::NoSuchElementError310 end311 end312 313end314Then /^I click button "([^\"]*)"$/ do |text|315 begin316 wait = Selenium::WebDriver::Wait.new(:timeout => 100)317 wait.until { @driver.find_element(:xpath, "//span/input[@value='#{text}']")318 @driver.find_element(:xpath, "//span/input[@value='#{text}']").click319 320 }321 322 rescue323 if @driver.page_source.match('SLI Exception')324 ele=false325 puts "SLI Exception"326 elsif Timeout::Error327 puts "TimeOut error"328 else329 raise Selenium::WebDriver::Error::NoSuchElementError330 end331 end332 333end334Then /^I should be on the admin page$/ do335 #begin336 #wait = Selenium::WebDriver::Wait.new(:timeout => 10)337 #wait.until{338 if @driver.find_element(:link, "Admin").displayed? 339 puts "On the admin Page"340 else341 puts "Not an admin Page"342 end343 # }344 345 #rescue346 #if @driver.page_source.match('SLI Exception')347 # ele=false348 # puts "SLI Exception"349 # elsif Timeout::Error350 # puts "TimeOut error"351 # else352 # raise Selenium::WebDriver::Error::NoSuchElementError353 # end354 #end355end356And /^I select the "([^\"]*)"$/ do |sel|357 #wait = Selenium::WebDriver::Wait.new(:timeout => 10)358 #wait.until{359 select=@driver.find_element(:tag_name, 'select')360 options=select.find_elements(:tag_name, "option")361 options.each do |g|362 if g.attribute('value') == sel363 g.click364 break365 end366 end367end368And /^I click "([^\"]*)"$/ do |btn|369 370 371end372Then /^It open a popup$/ do373 wait = Selenium::WebDriver::Wait.new(:timeout => 10)374 wait.until{375 frame=@driver.find_element(:tag_name, "iframe")376 @driver.switch_to.frame(frame)...

Full Screen

Full Screen

element.rb

Source:element.rb Github

copy

Full Screen

...22 #23 # flash the element by temporarily changing the background color24 #25 def flash26 original_color = attribute('backgroundColor')27 the_bridge = bridge28 10.times do |n|29 color = (n % 2 == 0) ? 'red' : original_color30 the_bridge.executeScript("arguments[0].style.backgroundColor = '#{color}'", element)31 end32 end33 34 #35 # Get the text for the element36 #37 # @return [String]38 #39 def text40 element.text41 end42 #43 # Get the html for the element44 #45 # @return [String]46 #47 def html48 script = "return (%s).apply(null, arguments)" % ATOMS.fetch(:getOuterHtml)49 bridge.executeScript(script, element).strip50 end51 #52 # Get the value of this element53 #54 # @return [String]55 #56 def value57 element.attribute('value')58 end59 #60 # compare this element to another to determine if they are equal61 #62 def ==(other)63 element == other.element64 end65 #66 # Get the tag name of this element67 #68 # @return [String]69 #70 def tag_name71 element.tag_name72 end73 #74 # Get the value of a the given attribute of the element. Will75 # return the current value, even if this has been modified76 # after the page has been loaded. More exactly, this method77 # will return the value of the given attribute, unless that78 # attribute is not present, in which case the value of the79 # property with the same name is returned. If neither value is80 # set, nil is returned. The "style" attribute is converted as81 # best can be to a text representation with a trailing82 # semi-colon. The following are deemed to be "boolean"83 # attributes, and will return either "true" or "false":84 #85 # async, autofocus, autoplay, checked, compact, complete,86 # controls, declare, defaultchecked, defaultselected, defer,87 # disabled, draggable, ended, formnovalidate, hidden, indeterminate,88 # iscontenteditable, ismap, itemscope, loop, multiple, muted,89 # nohref, noresize, noshade, novalidate, nowrap, open, paused,90 # pubdate, readonly, required, reversed, scoped, seamless, seeking,91 # selected, spellcheck, truespeed, willvalidate92 #93 # Finally, the following commonly mis-capitalized94 # attribute/property names are evaluated as expected:95 #96 # class, readonly97 #98 # @param [String]99 # attribute name100 # @return [String,nil]101 # attribute value102 #103 def attribute(attribute_name)104 element.attribute attribute_name105 end106 #107 # Fire the provided event on the current element108 #109 def fire_event(event_name)110 event_name = event_name.to_s.sub(/^on/, '').downcase111 script = "return (%s).apply(null, arguments)" % ATOMS.fetch(:fireEvent)112 bridge.executeScript(script, element, event_name)113 end114 #115 # hover over the element116 #117 def hover118 mouse = Selenium::WebDriver::Mouse.new(bridge)119 mouse.move_to(element)120 end121 #122 # hover over the element123 #124 def double_click125 mouse = Selenium::WebDriver::Mouse.new(bridge)126 mouse.double_click(element)127 end128 #129 # find the parent element130 #131 def parent132 script = "return (%s).apply(null, arguments)" % ATOMS.fetch(:getParentElement)133 parent = bridge.executeScript(script, element)134 type = element.attribute(:type).to_s.downcase if parent.tag_name.to_sym == :input135 cls = ::PageObject::Elements.element_class_for(parent.tag_name, type)136 cls.new(parent, :platform => :selenium_webdriver)137 end138 #139 # Set the focus to the current element140 #141 def focus142 bridge.executeScript("return arguments[0].focus()", element)143 end144 #145 # Select the provided text146 #147 def select_text(text)148 Watir::Atoms.load(:selectText)149 script = "return (%s).apply(null, arguments)" % ATOMS.fetch(:selectText)150 bridge.executeScript(script, element, text)151 end152 #153 # Click this element154 #155 def right_click156 element.context_click157 end158 #159 # Waits until the element is present160 #161 # @param [Integer] (defaults to: 5) seconds to wait before timing out162 #163 def when_present(timeout=::PageObject.default_element_wait)164 wait = Object::Selenium::WebDriver::Wait.new({:timeout => timeout, :message => "Element not present in #{timeout} seconds"})165 wait.until do166 self.exists?167 end168 self169 end170 #171 # Waits until the element is not present172 #173 # @param [Integer] (defaults to: 5) seconds to wait before174 # timing out175 #176 def when_not_present(timeout=::PageObject.default_element_wait)177 wait = Object::Selenium::WebDriver::Wait.new({:timeout => timeout, :message => "Element still present in #{timeout} seconds"})178 wait.until do179 not_present = false180 begin181 not_present = false if element and element.displayed?182 rescue Selenium::WebDriver::Error::ObsoleteElementError183 not_present = true184 end185 not_present186 end187 end188 #189 # Waits until the element is visible190 #191 # @param [Integer] (defaults to: 5) seconds to wait before timing out192 #193 def when_visible(timeout=::PageObject.default_element_wait)194 wait = Object::Selenium::WebDriver::Wait.new({:timeout => timeout, :message => "Element not visible in #{timeout} seconds"})195 wait.until do196 self.visible?197 end198 self199 end200 #201 # Waits until the element is not visible202 #203 # @param [Integer] (defaults to: 5) seconds to wait before timing out204 #205 def when_not_visible(timeout=::PageObject.default_element_wait)206 wait = Object::Selenium::WebDriver::Wait.new({:timeout => timeout, :message => "Element still visible in #{timeout} seconds"})207 wait.until do208 not self.visible?209 end210 self211 end212 #213 # Waits until the block returns true214 #215 # @param [Integer] (defaults to: 5) seconds to wait before timing out216 # @param [String] the message to display if the event timeouts217 # @param the block to execute when the event occurrs218 #219 def wait_until(timeout=::PageObject.default_element_wait, message=nil, &block)220 wait = Object::Selenium::WebDriver::Wait.new({:timeout => timeout, :message => message})221 wait.until &block222 end223 224 #225 # Send keystrokes to this element226 #227 # @param [String, Symbol, Array]228 #229 # Examples:230 #231 # element.send_keys "foo" #=> value: 'foo'232 # element.send_keys "tet", :arrow_left, "s" #=> value: 'test'233 # element.send_keys [:control, 'a'], :space #=> value: ' '234 #235 # @see Selenium::WebDriver::Keys::KEYS236 #237 def send_keys(*args)238 element.send_keys(*args)239 end240 241 #242 # clear the contents of the element243 #244 def clear245 element.clear246 end247 #248 # get the id of the element249 #250 def id251 attribute(:id)252 end253 #254 # Scroll until the element is viewable255 #256 def scroll_into_view257 element.location_once_scrolled_into_view258 end259 private260 def bridge261 bridge = element.instance_variable_get(:@bridge)262 end263 end264 end265 end...

Full Screen

Full Screen

selenium_element_spec.rb

Source:selenium_element_spec.rb Github

copy

Full Screen

...22 @selenium_element.exists?.should == false23 end24 it "should flash an element" do25 bridge = double('bridge')26 @selenium_driver.should_receive(:attribute).and_return('blue')27 @selenium_driver.should_receive(:instance_variable_get).and_return(bridge)28 bridge.should_receive(:executeScript).exactly(10).times29 @selenium_element.flash30 end31 it "should be able to return the text contained in the element" do32 @selenium_driver.should_receive(:text).and_return("my text")33 @selenium_element.text.should == "my text"34 end35 it "should know when it is equal to another" do36 @selenium_driver.should_receive(:==).and_return(true)37 @selenium_element.should == @selenium_element38 end39 it "should return its tag name" do40 @selenium_driver.should_receive(:tag_name).and_return("h1")41 @selenium_element.tag_name.should == "h1"42 end43 it "should know its value" do44 @selenium_driver.should_receive(:attribute).with('value').and_return("value")45 @selenium_element.value.should == "value"46 end47 it "should know how to retrieve the value of an attribute" do48 @selenium_driver.should_receive(:attribute).and_return(true)49 @selenium_element.attribute('readonly').should be true50 end51 it "should be clickable" do52 @selenium_driver.should_receive(:click)53 @selenium_element.click54 end55 it "should be double clickable" do56 Selenium::WebDriver::Mouse.should_receive(:new).and_return(@selenium_driver)57 @selenium_driver.should_receive(:double_click)58 @selenium_element.double_click59 end60 61 it "should be right clickable" do62 @selenium_driver.should_receive(:context_click)63 @selenium_element.right_click...

Full Screen

Full Screen

startBrowser.rb

Source:startBrowser.rb Github

copy

Full Screen

...9 }10 # A basic highlighting class for debugging purposes11 class HighlightAbstractTest12 def highlight(element, driver, color)13 orig_style = element.attribute("style")14 driver.execute_script("arguments[0].setAttribute(arguments[1], arguments[2])", element, "style", "border: 2px solid #{color}; color: #{color};")15 sleep 116 driver.execute_script("arguments[0].setAttribute(arguments[1], arguments[2])", element, "style", orig_style)17 end18 def call(*args)19 case args.first20 when :before_click21 #puts "Clicking #{args[1]}"22 highlight args[1], args[2], "red"23 when :before_find24 end25 end26 end27 # Start local chrome with the provided user-agent...

Full Screen

Full Screen

selenium_spec_ie.rb

Source:selenium_spec_ie.rb Github

copy

Full Screen

...13end14module TestSessions15 SeleniumIE = Capybara::Session.new(:selenium_ie, TestApp)16end17skipped_tests = %i[response_headers status_code trigger modals hover form_attribute windows]18$stdout.puts `#{Selenium::WebDriver::IE.driver_path} --version` if ENV['CI']19TestSessions::SeleniumIE.current_window.resize_to(1600, 1200)20Capybara::SpecHelper.run_specs TestSessions::SeleniumIE, 'selenium', capybara_skip: skipped_tests do |example|21 case example.metadata[:full_description]22 when /#refresh it reposts$/23 skip 'Firefox and Edge insist on prompting without providing a way to suppress'24 when /#click_link can download a file$/25 skip 'Not sure how to configure IE for automatic downloading'26 when /#fill_in with Date /27 pending "IE 11 doesn't support date input types"28 when /#click_link_or_button with :disabled option happily clicks on links which incorrectly have the disabled attribute$/29 pending 'IE 11 obeys non-standard disabled attribute on anchor tag'30 end31end32RSpec.describe 'Capybara::Session with Internet Explorer', capybara_skip: skipped_tests do33 include Capybara::SpecHelper34 include_examples 'Capybara::Session', TestSessions::SeleniumIE, :selenium_ie35 include_examples Capybara::RSpecMatchers, TestSessions::SeleniumIE, :selenium_ie36end...

Full Screen

Full Screen

attribute

Using AI Code Generation

copy

Full Screen

1driver.find_element(:name, 'q').send_keys "Selenium"2driver.find_element(:name, 'btnG').click3driver.find_element(:link_text, 'Selenium - Web Browser Automation').click

Full Screen

Full Screen

attribute

Using AI Code Generation

copy

Full Screen

1element = driver.find_element(:name, 'q')2wait = Selenium::WebDriver::Wait.new(:timeout => 20)3element = wait.until {4 element = driver.find_element(:name, 'q')5}6wait = Selenium::WebDriver::Wait.new(:timeout => 20)7element = wait.until {8 element = driver.find_element(:name, 'q')9}10wait = Selenium::WebDriver::Wait.new(:timeout => 20)11element = wait.until {12 element = driver.find_element(:name, 'q')13}14wait = Selenium::WebDriver::Wait.new(:timeout => 20)15element = wait.until {16 element = driver.find_element(:name, 'q')17}

Full Screen

Full Screen

attribute

Using AI Code Generation

copy

Full Screen

1options.add_argument('--headless')2driver.get('http://www.google.com/xhtml')3search_box = driver.find_element(name: 'q')4search_box.send_keys('Selenium')

Full Screen

Full Screen

attribute

Using AI Code Generation

copy

Full Screen

1driver.find_element(:name, "q").send_keys "Selenium WebDriver"2driver.find_element(:name, "btnG").click3driver.find_element(:name, "q").send_keys "Selenium WebDriver"4driver.find_element(:name, "btnG").click5driver.find_element(:name, "q").send_keys "Selenium WebDriver"6driver.find_element(:name, "btnG").click7driver.find_element(:name, "q").send_keys "Selenium WebDriver"8driver.find_element(:name, "btnG").click

Full Screen

Full Screen

attribute

Using AI Code Generation

copy

Full Screen

1element = driver.find_element(:name, 'q')2element = driver.find_element(:class, 'gsfi')3element = driver.find_element(:id, 'lst-ib')

Full Screen

Full Screen

attribute

Using AI Code Generation

copy

Full Screen

1search_box = driver.find_element(:name, 'q')2puts search_box.attribute('value')3search_box = driver.find_element(:name, 'q')4puts search_box.css_value('font-size')5search_button = driver.find_element(:name, 'btnK')

Full Screen

Full Screen

attribute

Using AI Code Generation

copy

Full Screen

1puts driver.find_element(:id, "hplogo").attribute("title")2element.attribute(attribute_name)3puts driver.find_element(:id, "hplogo").attribute("title")

Full Screen

Full Screen

attribute

Using AI Code Generation

copy

Full Screen

1search_box = driver.find_element(:name, 'q')2puts search_box.attribute('value')3search_box = driver.find_element(:name, 'q')4puts search_box.css_value('font-size')5search_button = driver.find_element(:name, 'btnK')

Full Screen

Full Screen

attribute

Using AI Code Generation

copy

Full Screen

1puts driver.find_element(:id, "hplogo").attribute("title")2element.attribute(attribute_name)3puts driver.find_element(:id, "hplogo").attribute("title")

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Selenium automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful