Skip to content

Commit 4e9f3d6

Browse files
Validate platformName Fix #146
1 parent 38fc42e commit 4e9f3d6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/appium_lib/driver.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -261,11 +261,13 @@ def initialize opts={}
261261

262262
# https://code.google.com/p/selenium/source/browse/spec-draft.md?repo=mobile
263263
@device = @caps[:platformName]
264+
@device = @device.downcase.strip if @device
264265
raise "Device must be set. Not found in options: #{opts}" unless @device
266+
raise 'platformName must be Android or iOS' unless %w[android ios].include?(@device)
265267

266268
# load common methods
267269
extend Appium::Common
268-
if @device.downcase.strip == 'android'
270+
if @device == 'android'
269271
# load Android specific methods
270272
extend Appium::Android
271273
else

0 commit comments

Comments
 (0)