danqa
March 14, 2016, 9:36pm
1
Hi everyone.
I have the the following in my appium.txt file:
[caps]
platformName = "iOS"
platformVersion = '9.2'
app = "blah.app"
deviceName = "iPhone 6"
sendKeyStrategy = "setValue"
autoWebview = "true"
when I use this to launch a test it works fine. But I want to make the tests more flexible and you cannot use names other than appium.txt for the caps file. So I am using the following:
caps = {
'platformName' => 'iOS',
'platformVersion' => '9.2',
'app' => 'blah.app',
'deviceName' => 'iPhone 6',
'sendKeyStrategy' => 'setValue',
'autoWebview' => 'true'
}
$appium_driver = Appium::Driver.new(caps)
However when I try to run the tests this way I get the following error:
Selenium::WebDriver::Error::SessionNotCreatedError:
The following desired capabilities are required, but were not provided: platformName, deviceName
I am specifying those values in the hash so not understanding what’s happening here.
Hoping someone can help.
Sincerely,
wreed
March 14, 2016, 10:49pm
2
I think you are missing the symbol caps:
So something like this:
caps = {
'platformName' => 'iOS',
'platformVersion' => '9.2',
'app' => 'blah.app',
'deviceName' => 'iPhone 6',
'sendKeyStrategy' => 'setValue',
'autoWebview' => 'true'
}
$appium_driver = Appium::Driver.new(caps: caps)
Check out the initialize method for Driver here:
# frozen_string_literal: true
# Licensed 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.
# Load only Minitest is loaded
if defined?(Minitest::VERSION)
# Fix uninitialized constant Minitest (NameError)
module Minitest
# Fix superclass mismatch for class Spec
class Runnable
This file has been truncated. show original
From the comments:
Start iOS driver
# 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(opts).start_driver
# ```
1 Like
danqa
March 15, 2016, 1:37pm
3
Hi wreed.
That was it. Thank you VERY MUCH!
Sincerely