lib/appium_lib/driver.rb in appium_lib-2.0.0 vs lib/appium_lib/driver.rb in appium_lib-2.1.0

- old
+ new

@@ -224,11 +224,11 @@ # opts = { caps: { platformName: :ios, app: '/path/to/MyiOS.app' } } # Appium::Driver.new(opts).start_driver # # # Start Android driver # opts = { caps: { platformName: :android, app: '/path/to/my.apk' } } - # Appium::Driver.new(apk).start_driver + # Appium::Driver.new(opts).start_driver # ``` # # @param opts [Object] A hash containing various options. # @return [Driver] def initialize opts={} @@ -246,11 +246,13 @@ @custom_url = appium_lib_opts.fetch :server_url, false @export_session = appium_lib_opts.fetch :export_session, false @default_wait = appium_lib_opts.fetch :wait, 30 @last_waits = [@default_wait] @sauce_username = appium_lib_opts.fetch :sauce_username, ENV['SAUCE_USERNAME'] + @sauce_username = nil if @sauce_username.nil? || @sauce_username.empty? @sauce_access_key = appium_lib_opts.fetch :sauce_access_key, ENV['SAUCE_ACCESS_KEY'] + @sauce_access_key = nil if @sauce_access_key.nil? || @sauce_access_key.empty? @port = appium_lib_opts.fetch :port, 4723 # Path to the .apk, .app or .app.zip. # The path can be local or remote for Sauce. unless !@caps || @caps[:app].nil? || @caps[:app].empty? @@ -277,13 +279,14 @@ patch_webdriver_element # enable debug patch # !!'constant' == true @debug = appium_lib_opts.fetch :debug, !!defined?(Pry) - puts "Debug is: #{@debug}" + if @debug ap opts unless opts.empty? + puts "Debug is: #{@debug}" puts "Device is: #{@device}" patch_webdriver_bridge end @@ -417,9 +420,10 @@ def start_driver @client = @client || Selenium::WebDriver::Remote::Http::Default.new @client.timeout = 999999 begin + driver_quit @driver = Selenium::WebDriver.for :remote, http_client: @client, desired_capabilities: @caps, url: server_url # Load touch methods. @driver.extend Selenium::WebDriver::DriverExtensions::HasTouchScreen # export session