Not able to tap Date of birth field through 'find element by id' in Appium-ruby(Native iOS App) for automation? - ios

Getting below error in Appium
REMOTE] Could not connect to WebKitRemoteDebugger server
info: --> GET /wd/hub/session/81921036-ccb1-4ca3-9b97-319145e345fe/contexts {}
info: [debug] [REMOTE] Getting WebKitRemoteDebugger pageArray
info: [debug] Responding to client with error: {"status":13,"value":{"message":"An unknown server-side error occurred while processing the command. (Original error: connect ECONNREFUSED)","code":"ECONNREFUSED","errno":"ECONNREFUSED","syscall":"connect","origValue":"connect ECONNREFUSED"},"sessionId":"81921036-ccb1-4ca3-9b97-319145e345fe"}
info: <-- GET /wd/hub/session/81921036-ccb1-4ca3-9b97-319145e345fe/contexts 500 2.415 ms - 293
Versions used
Xcode : 7.2
Appium :1.6
Desired Capabilities:
require "appium_lib"
def caps
{
caps:{ deviceName: "YIP-25",
platformName: "iOS",
Fullreset: "false",
Noreset: "true",
app: (File.join(File.dirname(FILE), "app-fs-debug.ipa")),
Packagename: "br.com.fs.ensinabyfs",
newCommandTimeout: "3600",
autoGrantPermissions: "true",
appium_lib: { wait: 20,
debug: false,
}
}
}
end
def server_url
'http://0.0.0.0:4723/wd/hub'
end
Appium::Driver.new(caps) #Pass capabilities for appium inside the driver
Appium.promote_appium_methods Object #Makes all appium_lib methods accessible from steps
$driver.start_driver #Starts appium driver before the tests begin
Please help me out in this?

Update your xcode to 8.x latest version .
Update your Appium to 1.6.4 latest version .
Update you appium_lib gem version to latest version .
Install appium_doctor
npm install -g appium-doctor
appium-doctor --ios
This will check the health of your appium ios setup
Then run your tests as XCUITest and not as UIAutomator
Following are capabilities you can use:
You need to use capability
caps = {
:platformName => "iOS",
:deviceName => "iPhone 6",
:platformVersion => "9.3",
:app => app_path,
:noReset => 'true',
:newCommandTimeout => "30",
:automationName => "XCUITest",
:sendKeyStrategy => 'setValue'
}
Now that done, once appium starts, just try to find your element like normal web element
driver.find_element(id: 'dob').click
Hope it helps!!

Related

I need to use Appium 2 for CodeceptJS mobile tests

Because latest iOS is making problems with Appium 1.x, Appium team is no longer supporting it,
and Appium 2 is working ok - I need to use v2...
CodeceptJS 3.3.x is using Appium 1.x now and because of the '/wd/path' used by default in CodeceptJS Appium helper, I can't set it to use Appium 2.
When starting a test, CodeceptJS fails with:
Error: Failed to create session.
The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
Please make sure Selenium Server is running and accessible
Error: Can't connect to WebDriver.
Error: Failed to create session.
The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
Please make sure Selenium Server is running and accessible
And Appium 2 fails with:
[debug] [HTTP] No route found for /wd/hub/session
[HTTP] <-- POST /wd/hub/session 404 1 ms - 211
Is there a way to change the default '/wd/path' to just '/' ?
Or is there another helper or something for Appium 2?
Part of the codecept.config.js file:
Appium: {
host: process.env.CLOUD_HOST || 'localhost',
port: parseInt(process.env.CLOUD_PORT) || 4723,
app: (PLATFORM_NAME === 'iOS') ? APP_PATH_IOS || 'com.mobile.beta' : APP_PATH_ANDROID,
desiredCapabilities: {
platformName: process.env.PLATFORM_NAME || 'iOS',
platformVersion: process.env.PLATFORM_VERSION || '16.0',
automationName: process.env.AUTOMATION_NAME || 'xcuitest',
deviceName: process.env.DEVICE_NAME || 'iPhone Xs',
appPackage: process.env.APP_PACKAGE,
appActivity: process.env.APP_ACTIVITY,
xcodeOrgId: process.env.XCODE_ORG_ID,
// udid: process.env.UDID, // used only for real iOS device
},
},
=========================================
UPDATE:
I started Appium with --base-path /wd/hub (appium --base-path /wd/hub) but now another error appears:
Error: Can't connect to WebDriver.
Error: Failed to create session.
All non-standard capabilities should have a vendor prefix. The following capabilities did not have one: platformVersion,automationName,deviceName,appPackage,appActivity,xcodeOrgId,app
Please make sure Selenium Server is running and accessible
I tried updating the capabilities in codecept.conf.js with appium: prefix, but either I do it wrong or it doesn't work:
The Update:
Appium: {
host: process.env.CLOUD_HOST || 'localhost',
port: parseInt(process.env.CLOUD_PORT) || 4723,
app: (PLATFORM_NAME === 'iOS') ? APP_PATH_IOS || 'com.mobile.beta' : APP_PATH_ANDROID,
desiredCapabilities: {
'appium:platformName': process.env.PLATFORM_NAME || 'iOS',
'appium:platformVersion': process.env.PLATFORM_VERSION || '16.0',
'appium:automationName': process.env.AUTOMATION_NAME || 'xcuitest',
'appium:deviceName': process.env.DEVICE_NAME || 'iPhone Xs',
'appium:appPackage': process.env.APP_PACKAGE, // not needed for iOS
'appium:appActivity': process.env.APP_ACTIVITY, // not needed for iOS
'xcodeOrgId': process.env.XCODE_ORG_ID, // not needed for Android
udid: process.env.UDID, // used only for real iOS device testing
},
},
Error:
Error: Can't connect to WebDriver.
Error: Invalid or unsupported WebDriver capabilities found ("platformVersion", "deviceName", "appPackage", "appActivity", "xcodeOrgId", "app", "tunnelIdentifier"). Ensure to only use valid W3C WebDriver capabilities (see https://w3c.github.io/webdriver/#capabilities).If you run your tests on a remote vendor, like Sauce Labs or BrowserStack, make sure that you put them into vendor specific capabilities, e.g. "sauce:options" or "bstack:options". Please reach out to to your vendor support team if you have further questions.
Please make sure Selenium Server is running and accessible
Error#2:
Error: Can't connect to WebDriver.
Error: Invalid or unsupported WebDriver capabilities found ("deviceName", "app", "tunnelIdentifier"). Ensure to only use valid W3C WebDriver capabilities (see https://w3c.github.io/webdriver/#capabilities).If you run your tests on a remote vendor, like Sauce Labs or BrowserStack, make sure that you put them into vendor specific capabilities, e.g. "sauce:options" or "bstack:options". Please reach out to to your vendor support team if you have further questions.
Please make sure Selenium Server is running and accessible
If you are starting Appium server using the CLI you can use something like appium -p 4726 --base-path /wd/hub which will make it accept requests on the old endpoint
Update:
With Appium 2.0, the Appium server will enforce strict compability with the W3C WebDriver specification when it comes to Capabilities. They can be found here. Anything else that you provide for Appium should have the appium: prefix (like appium:platformVersion, appium:appPackage and so on)
This is most probably a problem with the CodeceptJS's Appium helper and needs to be updated to follow the Appium's more strict compability with the W3C WebDriver specification.
The update needs a support for prefixes like:
...
appium:platformName: 'iOS'
appium:automationName: 'xcuitest'
...
or
...
browserstack:platformName: 'Android'
saucelabs:automationName: 'uiautomator2'
...
for now, we can't configure variables with prefixes.
There's also no way I know of, to contact the CodeceptJS maintainers for making this update.

intermittently occuring appium unknown server-side error

I seem to get this issue intermittently. no error if i were to un plug and replug the devices and re-excuite the test, however this is only temperory fix till the time it shows up again.
i have 2 instances of appium server for 2 devices-
server1
Host-0.0.0.0
server port-5050
Bootstrap port- 4734
allow session overrides- ticked
server2
Host-0.0.0.0
server port-4723
Bootstrap port- 4724
allow session overrides- ticked
appium version- 1.15.1
List of devices attached-
52002dd24392b5a1 device
5200472dec01a4a9 device
error on appium server console-
W3C] Encountered internal error running command: Error: Cannot start the 'com.XYZ.XYZ' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command ''C:\\Users\\XYZ\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe' -P 5037 -s 5200472dec01a4a9 shell am start -W -n com.XYZ.XYZ/host.exp.exponent.LauncherActivity -S' timed out after 120000ms'. Try to increase the 120000ms adb execution timeout represented by 'adbExecTimeout' capability
[W3C] at ADB.startApp (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\apk-utils.js:153:11)
[HTTP] <-- POST /wd/hub/session 500 132866 ms - 1782
[HTTP]
[Instrumentation] .
[Instrumentation] Time: 123.085
[Instrumentation]
[Instrumentation] OK (1 test)
[Instrumentation] The process has exited with code 0
error on IDE-
org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.XYZ.XYZ' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command ''C:\\Users\\XYZ\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe' -P 5037 -s 5200472dec01a4a9 shell am start -W -n com.XYZ.XYZ/host.exp.exponent.LauncherActivity -S' timed out after 120000ms'. Try to increase the 120000ms adb execution timeout represented by 'adbExecTimeout' capability
Driver info: driver.version: AndroidDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.XYZ.XYZ' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command ''C:\\Users\\XYZ\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe' -P 5037 -s 5200472dec01a4a9 shell am start -W -n com.XYZ.XYZ/host.exp.exponent.LauncherActivity -S' timed out after 120000ms'. Try to increase the 120000ms adb execution timeout represented by 'adbExecTimeout' capability
desired capabilities for device1-
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "Tab");
capabilities.setCapability("platformVersion", "8.0.0");
capabilities.setCapability("platformName", "ANDROID");
capabilities.setCapability("udid", "5200472dec01a4a9");
capabilities.setCapability("noReset", "true");
capabilities.setCapability("appPackage", "com.xyz.xyz");
capabilities.setCapability("appActivity", "host.exp.exponent.LauncherActivity");
capabilities.setCapability("adbExecTimeout", 120000);
capabilities.setCapability("newCommandTimeout", 3000);
capabilities.setCapability("noSign", "true");
URL mobileURL = new URL("http://0.0.0.0:5050/wd/hub");
mobileParent = new AndroidDriver(mobileURL, capabilities);
mobile capabilities for device2-
capabilities.setCapability("deviceName", "Tab");
capabilities.setCapability("platformVersion", "8.0.0");
capabilities.setCapability("platformName", "ANDROID");
capabilities.setCapability("udid", "52002dd24392b5a1");
capabilities.setCapability("noReset", "true");
capabilities.setCapability("appPackage", "com.coachhire.kura");
capabilities.setCapability("appActivity", "host.exp.exponent.LauncherActivity");
capabilities.setCapability(AndroidMobileCapabilityType.AUTO_GRANT_PERMISSIONS, true);
capabilities.setCapability("adbExecTimeout", 120000);
capabilities.setCapability("newCommandTimeout", 3000);
capabilities.setCapability("noSign", "true");
URL mobileURL = new URL("http://0.0.0.0:4723/wd/hub");
mobileDriver = new AndroidDriver(mobileURL, capabilities);
any help greatly appretiated!
Looking at the details you have provided, there should not be any errors. It should work fine.
Unknown error usually accrues when Appium not able to figure out the list of capabilities provided for the run. I would suggest double check appPackage and appActivity details are right.
Also, try to run tests on one devices and see any errors. see the consistency of test run. if not errors than you can add one more device and see how it goes.
Add below in the capabilities,
"automationName": "UiAutomator2"
If you are running test on local machine use http://127.0.0.1:<Port>/wd/hubinstead 0.0.0.0
If you are running tests remotely make sure in above, local IP 127.0.0.0 replaced with the machine IP where Appium server is running.
As you are running Android devices only, I hope prerequisites softwares are installed as per Android test setup.
For mac device setup, follow steps here - https://www.swtestacademy.com/how-to-install-appium-on-mac/
Try below steps,
Check you can install the app manually by running below command.
adb -P <port> -s <device id > shell pm install -t -g <apk path>
If this could work, it indicates that there are no issues with the device. Else, you should reset the device and re test it.
Check Appium server is running with no issues. and access this link and see you get 200 response on appium server console.
http://<appium server ip>:4723/wd/hub/sessions
If you see an error there, it indicates that there is an issue with Appium. Un-install and install stable version of Appium and re test.
You should know that sometimes Node.js could not talk to 127.0.0.1:4723, So use 0.0.0.0:4723 instead and visa versa. Remember to change this in both code (DesiredCapabilities) and appium setting.
Try "udid" parametre is required for desired capabilities -
Example, caps.setCapability("udid", "ce0217124184c72505"); //DeviceId from "adb devices" command

Intern 3.4 on IOS safari

When I try to execute intern script on ios simulator, safari window launches out side of simulator and opens page let's browse and further script will never execute.
this is happening for all simulators?
This was working previously, but I played little with npm install ios-deploy, tried to install it and remove it.
but since then it stopped working.
And could can anyone please tell me the need of ios-deploy in case of executing intern script on ios simulator.
I have tried shutdown erase of ios simulator and ios deploy
Sample intern.js file `define({
defaultTimeout: 900000,
reporters: [{id: 'LcovHtml', directory: 'InternHTMLResult'}, {id: 'Console'}],
  environments: [
        { platformName: 'iOS',
            deviceName: 'iPhone 6', // for example
           bundleId: 'com.apple.mobilesafari', // for example
            automationName: 'XCUITest',
browserName: 'safari',
//platformVersion: '10.3', // for example
Simulator: true,
            fixSessionCapabilities: false
      }
    ],
maxConcurrency: 5,
tunnel: 'NullTunnel',
tunnelOptions : {
port: Number('4723')
},
functionalSuites: ['tests/functional/3DExpLogin1.js'],
excludeInstrumentation: true
// excludeInstrumentation: /^(?:node_modules)//
});
`

Calabash RunLoop::Fifo::NoReaderConfiguredError when trying to launch

I was running Clabash tests yesterday fine, I went home and this morning I am not able to get the app to launch on my physical device (iPhone 6, iOS 9.0.1.) I keep running into the error above, here's the exact output:
Error while writing to fifo. RunLoop::Fifo::NoReaderConfiguredError
Failed to launch. Error while writing to fifo. RunLoop::Fifo::NoReaderConfiguredError: Error while writing to fifo. RunLoop::Fifo::NoReaderConfiguredError
Then I get a more general error after 5 retries:
Unable to start. Make sure you've set APP_BUNDLE_PATH to a build supported by this simulator version
Calabash::Cucumber::Launcher::StartError: Calabash::Cucumber::Launcher::StartError:
"Timed out waiting for UIAutomation run-loop Error while writing to fifo. RunLoop::Fifo::NoReaderConfiguredError.
Logfile: /var/folders/hz/l8c5m9qn31v863pp7lc52b7m0000gn/T/run_loop20151015-2775-4w2qzv/run_loop.out
Info on my Calabash setup:
calabash-ios version
0.16.4
xcode-select --print-path
/Applications/Xcode.app/Contents/Developer
xcodebuild -version
Xcode 7.0
Build version 7A218
server_version
{
"device_family" => "iPhone Simulator",
"outcome" => "SUCCESS",
"server_port" => 37265,
"simulator_device" => "iPhone",
"simulator" => "CoreSimulator 179 - Device: iPhone 5s - Runtime: iOS 8.4 (12H141) - DeviceType: iPhone 5s",
"app_name" => "Discover",
"app_version" => "1",
"screen_dimensions" => {
"sample" => 1,
"height" => 1136,
"width" => 640,
"scale" => 2
},
"git" => {
"revision" => "3bf68ff",
"remote_origin" => "git#github.com:calabash/calabash-ios-server.git",
"branch" => "master"
},
"device_name" => "iPhone Simulator",
"4inch" => true,
"app_id" => "com.solstice.discoverfinancialenterprise.mobile",
"form_factor" => "iphone 4in",
"system" => "x86_64",
"version" => "0.16.4",
"iOS_version" => "8.4",
"short_version_string" => "6.6.1 UAT",
"ios_version" => "8.4",
"iphone_app_emulated_on_ipad" => false,
"model_identifier" => "iPhone6,1",
"app_base_sdk" => "iphonesimulator9.0"
}
I went home and this morning I am not able to get the app to launch on my physical device
There is a Hot Topic for this exact issue. The link points to the Hot Topic page rather than the specific issue because the content on that page is ephemeral.
Please update your question with the exact command you are using - most important is to include what variables you are setting.

Can't deploy Visual Studio Cordova app to iPhone using remote agent: CordovaModuleLoadError

I am trying to deploy my Cordova app to my iPhone using Visual Studio 2015 RC by Remote Agent > Local Device. I have successfully installed, ran and connect the remote agent to my Visual Studio. According to this link, when I run Local Device, iTunes should pop up on my Windows PC and install the app to my iPhone:
https://msdn.microsoft.com/en-us/library/dn757056.aspx
New build request submitted:
/build/tasks?command=build&vcordova=4.3.0&cfg=debug&options=--device
{ 'accept-language': 'en-US',
host: '192.168.0.9:3000',
connection: 'keep-alive',
'transfer-encoding': 'chunked' }
New build request submitted for cordovaVersion: 4.3.0; buildCommand: build; configuration: debug
Build will be executed under: /Users/JP/remote-builds/builds/3563
Saving build request payload to : /Users/JP/remote-builds/builds/3563
Saved upload to /Users/JP/remote-builds/builds/3563/upload_3563.tgz
Extracting /Users/JP/remote-builds/builds/3563/upload_3563.tgz to /Users/JP/remote-builds/builds/3563/cordovaApp...
POST /build/tasks?command=build&vcordova=4.3.0&cfg=debug&options=--device 202 5123ms - 487b
GET /build/tasks/3563 200 0ms - 487b
Extracted app contents from uploaded build request to /Users/JP/remote-builds/builds/3563/cordovaApp. Requesting build.
Taking 3563 as current build
Building cordova app CordovaApp2 at appDir /Users/JP/remote-builds/builds/3563/cordovaApp
Opened build log file /Users/JP/remote-builds/builds/3563/build.log
Done building 3563 : error CordovaModuleLoadError [ '4.3.0' ]
Done with currentBuild. Checking for next build in queue.
GET /build/tasks/3563 200 4ms - 142.31kb
GET /build/tasks/3563/log 200 1ms
Additionally, from Visual Studio I get the error:
EACCES, open '/Users/JP/.npm/_locks/cordova-46ce3f50013cb5f4.lock' CordovaApp2 C:\Users\J\Documents\Visual Studio 2015\Projects\CordovaApp2\CordovaApp2\MDAVSCLI 1
Remote build error from the build server undefined: {1} CordovaApp2 C:\Users\J\Documents\Visual Studio 2015\Projects\CordovaApp2\CordovaApp2\MDAVSCLI 1
When running remote test:
$ vs-mda-remote test --device
Initializing self test for https
downloading cert for pin 360583
Downloading client cert for selftest from https://Jamess-Mac-mini.local:3000/certs/360583 to /Users/JP/remote-builds/selftest/selftest-client.pfx
pfxPath: /Users/JP/remote-builds/selftest/selftest-client.pfx
serverUrl: https://Jamess-Mac-mini.local:3000
buildUrl: https://Jamess-Mac-mini.local:3000/build/tasks?vcordova=4.3.0&cfg=release&command=build&options=--device
Response statusCode: 202
{ 'x-powered-by': 'Express',
'content-type': 'application/json',
'content-location': 'https://jamess-mac-mini.local:3000/build/tasks/3570',
'content-length': '489',
date: 'Tue, 09 Jun 2015 22:05:58 GMT',
connection: 'close' }
Response: {
"buildNumber": 3570,
"status": "uploaded",
"cordovaVersion": "4.3.0",
"buildCommand": "build",
"configuration": "release",
"options": "--device",
"buildDir": "/Users/JP/remote-builds/builds/3570",
"serverDir": "/Users/JP/remote-builds",
"submissionTime": "2015-06-09T22:05:58.691Z",
"changeList": null,
"tgzFilePath": "/Users/JP/remote-builds/builds/3570/upload_3570.tgz",
"statusTime": "2015-06-09T22:05:58.763Z",
"message": "Uploaded build request payload."
}
buildingUrl: https://Jamess-Mac-mini.local:3000/build/tasks?vcordova=4.3.0&cfg=release&command=build&options=--device
[1] Response: {
"buildNumber": 3570,
"status": "error",
"cordovaVersion": "4.3.0",
"buildCommand": "build",
"configuration": "release",
"options": "--device",
"buildDir": "/Users/JP/remote-builds/builds/3570",
"serverDir": "/Users/JP/remote-builds",
"submissionTime": "2015-06-09T22:05:58.691Z",
"changeList": null,
"tgzFilePath": "/Users/JP/remote-builds/builds/3570/upload_3570.tgz",
"messageId": "CordovaModuleLoadError",
"statusTime": "2015-06-09T22:05:59.752Z",
"appDir": "/Users/JP/remote-builds/builds/3570/cordovaApp",
"appName": "HelloCordova",
"messageArgs": [
"4.3.0"
]
}
You are likely encountering the following Known Issue. Basically there's a file somewhere in your npm cache that was added while running as an administrator (sudo). As a result, vs-mda-remote cannot access it. The commands below resolve that issue (and in fact this is what recent versions of npm do by default).
iOS Build Related Known Issues
After installing the latest version of vs-mda-remote package, you may need to run the following commands before you start up the remote agent. These commands ensure your user has permissions to the contents of the npm package cache in your home directory when using older versions of Node.js and npm. Newer versions of Node.js and npm will do this for you automatically.
sudo npm cache clear
sudo chown -R `whoami` ~/.npm

Resources