Module: WebDriverUtils

Defined in:
lib/webdriver_utils/wait.rb,
lib/webdriver_utils/page.rb,
lib/webdriver_utils/version.rb,
lib/webdriver_utils/silence_gem_warnings.rb

Overview

github.com/SeleniumHQ/selenium/blob/b12ff650686cd88a0709f6181a015dad1062591e/rb/lib/selenium/webdriver/common/wait.rb

Licensed to the Software Freedom Conservancy (SFC) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The SFC licenses this file to you under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Defined Under Namespace

Classes: Wait

Constant Summary collapse

VERSION =
'0.0.2'
DATE =
'2015-05-10'

Class Method Summary collapse

Class Method Details

.define_page_methods(opts = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/webdriver_utils/page.rb', line 8

def define_page_methods opts={}
  page_module   = opts[:page_module] || raise('must set page_module')
  target_class  = opts[:target_class] || raise('must set target_class')
  driver_object = opts[:driver] || raise('must set driver')
  page_module.constants.each do |page_class|
    # ButtonsPage => buttons_page
    # https://github.com/rails/rails/blob/daaa21bc7d20f2e4ff451637423a25ff2d5e75c7/activesupport/lib/active_support/inflector/methods.rb#L96
    page_name = page_class.to_s.gsub(/([a-z])([A-Z])/, '\1_\2').downcase
    target_class.send(:define_singleton_method, page_name) do
      page_module.const_get(page_class).new driver_object
    end
  end
end

.require_all_pages(glob_path = nil) ⇒ Object



3
4
5
6
# File 'lib/webdriver_utils/page.rb', line 3

def require_all_pages glob_path=nil
  glob_path ||= File.join(Rake.application.original_dir, 'page', '**', '*.rb')
  Dir.glob(glob_path) { |file| require_relative file }
end

.silence_gem_warningsObject



3
4
5
6
7
8
9
# File 'lib/webdriver_utils/silence_gem_warnings.rb', line 3

def silence_gem_warnings
  # https://github.com/appium/ruby_console/blob/1049c515432212f164cfbabd413d6e3d82e4aada/lib/appium_console.rb#L5
  Gem::Specification.class_eval do
    def self.warn args
    end
  end
end