lib/appium_lib/driver.rb in appium_lib-0.7.0 vs lib/appium_lib/driver.rb in appium_lib-0.7.1
- old
+ new
@@ -192,11 +192,11 @@
@@loaded = false
attr_reader :default_wait, :app_path, :app_name, :device,
:app_package, :app_activity, :app_wait_activity,
:sauce_username, :sauce_access_key, :port, :debug,
- :export_session, :device_cap, :compress_xml
+ :export_session, :device_cap, :compress_xml, :custom_url
# The amount to sleep in seconds before every webdriver http call.
attr_accessor :global_webdriver_http_sleep
# Creates a new driver.
# :device is :android, :ios, or :selendroid
@@ -232,10 +232,12 @@
$driver.driver_quit if $driver
opts = {} if opts.nil?
# convert to downcased symbols
opts.each_pair { |k,v| opts[k.to_s.downcase.strip.intern] = v }
+ @custom_url = opts.fetch :server_url, false
+
@compress_xml = opts[:compress_xml] ? true : false
@export_session = opts.fetch :export_session, false
@default_wait = opts.fetch :wait, 30
@@ -397,9 +399,10 @@
end
# Get the server url for sauce or local based on env vars.
# @return [String] the server url
def server_url
+ return @custom_url if @custom_url
if !@sauce_username.nil? && !@sauce_access_key.nil?
"http://#{@sauce_username}:#{@sauce_access_key}@ondemand.saucelabs.com:80/wd/hub"
else
"http://127.0.0.1:#{@port}/wd/hub"
end
\ No newline at end of file