lib/actir/webdriver/browser.rb in actir-1.4.0 vs lib/actir/webdriver/browser.rb in actir-1.4.1
- old
+ new
@@ -80,11 +80,11 @@
end
# 初始化入参
def init_args(args = {})
config_exist = File.exist?(config_file)
- unless args.has_key?(:mode)
+ unless args.has_key?(:mode) && args[:mode] != nil
#若通过actir执行测试用例,则会配置ENV的模式
if ENV["mode"]
args[:mode] = ENV["mode"].to_sym
else
#若ENV为空,则读取配置文件,判断有无配置文件
@@ -94,19 +94,19 @@
else
args[:mode] = :local
end
end
end
- unless args.has_key?(:browser)
+ unless args.has_key?(:browser) && args[:browser] != nil
if config_exist
browser_type = $config["config"]["test_mode"]["browser"]
args[:browser] = (browser_type == nil) ? :chrome : browser_type
else
args[:browser] = :chrome
end
end
- unless args.has_key?(:window_size)
+ unless args.has_key?(:window_size) && args[:window_size] != nil
if config_exist
window_size = $config["config"]["window_size"]
if window_size != nil
width = window_size["width"]
height = window_size["height"]
@@ -114,11 +114,11 @@
args[:window_size] = (width == nil || height == nil) ? nil : window_size
else
args[:window_size] = nil
end
end
- args[:agent] = :iphone unless args.has_key?(:agent)
- args[:url] = $address unless args.has_key?(:url)
+ args[:agent] = :iphone unless args.has_key?(:agent) && args[:agent] != nil
+ args[:url] = $address unless args.has_key?(:url) && args[:url] != nil
args
end
#