wdio appium locally not finding elements - appium

Using WebdriverIO, we are successfully running web app tests on desktop browsers locally and on saucelabs for desktop browsers and mobile browsers.
We are trying to use the same tests on mobile iOS simulator and Android emulator on our local macOS machines unsuccessfully.
We are using webdriverIO 7.25.4 and appium 2.0, we are not using wdio's Appium Service. Both Android Emulator and iOS simulator start when running tests but the first test fail. Regardless of the element targeted we always get an error similar to this:
ERROR #wdio/utils:shim: Error: element ("#usernameInput") still not displayed after 10000ms
Capability looks like this:
{
'platformName': 'ios',
'appium:automationName': 'XCUITest',
'appium:deviceName': 'iPad Pro (12.9-inch) (5th generation)',
'appium:platformVersion': '16.0',
'appium:fullReset': true,
'appium:printPageSourceOnFindFailure': true,
},
Has anyone ever seen this before running appium locally?

If it helps anyone, turns out that I forgot to add browserName in the capabilities. All works fine now.
{
'platformName': 'ios',
'browserName': 'Safari',
'appium:automationName': 'XCUITest',
'appium:deviceName': 'iPad Pro (12.9-inch) (5th generation)',
'appium:platformVersion': '16.0',
'appium:fullReset': true,
'appium:printPageSourceOnFindFailure': true,
},

Related

Problème de configuration Appium pour iOS

I have a problem to communicate between my macmini and my iphone 7 (version 11.4) with Appium. My build is successfull on xCode and the version of Appium is the last 1.18.0-1.
My capabilities in Appium are :
{
"platformName": "iOS",
"platformVersion": "11.4",
"bundleId": "com.altran.deltadore.tydom",
"deviceName": "iPhone7",
"udid": "0afc3d4352c3f2d720a9ffca2d971b118b9a7e17",
"xcodeSigningId": "jerome.thomoux#altran.com",
"xcodeOrgId": "WUQ4U559T2",
"automation_name": "XCUITest"
}
The error message in Appium when I start the session is :
An unknown server-side error occurred while processing the command. Original error: App with bundle identifier 'com.altran.deltadore.tydom' unknown
Add one more capability as :
"app" : "Path_to_your_ipa_file";
Secondly, you have to add udid while signing the ipa build for the devices you have to use the build.

Appium - Install iOS apps from a testflight public url

I'm trying to install / run an iOS app from a test flight public url when using appium desktop but get the following error when starting the session:
"An unknown server-side error occurred while processing the command. Original error: Could not install app: 'ENOTDIR: not a directory, scandir '/var/folders/[DIRECTORY_PATH]/[RANDOM_GENERATED_CODE].app''"
The desired capabilities I provided to appium desktop are shown below:
{
"automationName": "XCUITest",
"platformName": "iOS",
"deviceName": "[DEVICE_NAME]",
"platformVersion": "13.3",
"xcodeOrgId": "[XCODE_ORG_ID]",
"xcodeSigningId": "iPhone Developer",
"udid": "[DEVICE_UDID]",
"bundleId": "[APP_BUNDLE_ID]",
"updatedWDABundleId": "[WEDRIVER_AGENT_RUNNER]",
"app": "https://testflight.apple.com/join/[RANDOM_GENERATED_CODE]"
}
Does appium support this functionality? If so what am i missing?
You should try to download the app before setting up Appium. (with bash script or Java itself)
After downloading, set the local URL in the capabilities.
This error:
install app: 'ENOTDIR: not a directory, scandir '/var/folders/[DIRECTORY_PATH]/[RANDOM_GENERATED_CODE].app''"
Seems to indicate you are pointing to a file, not a directory, which is what the executing code expected. Are you supposed to expand the artifacts from TestFlight before using them? Perhaps something is wrong with the [DirectoryPath] you specified. What's actually at that location after the failure occurs?

Fastlane testing tries to boot another device

I'm starting project unit tests via fastlane.
I have 2 devices for testing: iPad Air 2 and iPhone 6 plus.
But in console I can see next lines:
SimDevice: iPhone 6 Plus (<device code removed>, iOS 11.4, Booted)
(11.4 (15F79))
2018-11-16 14:34:45.608 xcodebuild[42659:1368186]
iPhoneConnect: ## Unable to mount developer disk image,
(Error Domain=com.apple.dtdevicekit Code=601 "Could not
locate device support files." UserInfo={DeviceType=iPhone9,3,
NSLocalizedDescription=Could not locate device support files.,
NSLocalizedRecoverySuggestion=This iPhone 7 (Model 1660, 1778, 1779, 1780)
is running iOS 12.0 (16A366), which may not be supported by this version of Xcode.})
The question is for which tasks does it try to mount disk image and boot iPhone 7 for tests? Btw it loops on this.
What does it mean?
Note: I have 2 XCode's - 9 and 10. Maybe it affects somehow.
Edit 1.
I do start tests via scan (it is alias) command:
scan(
workspace: "Name.xcworkspace",
scheme: "Name",
clean: false,
devices: devices_for_testing
)
Btw, tests finally completed, but I want to know, why has this output appeared.

Error while connecting real iOS device with Appium server

I'm trying to open the application from Appium server and getting the below mentioned error.
An unknown server-side error occurred while processing the command.
Original error: Unknown device or simulator UDID:
'046e4469d6cb14ff57e378599bd4b1d09390472b'
{
"platformName": "iOS",
"deviceName": "iPad",
"automationName": "XCUITest",
"udid": "046e4469d6cb14ff57e378599bd4b1d09390472b",
"bundleId": "com.***",
"platformVersion": "11.2.6",
"app": "/Users/***/***.ipa"
}
even tried with app location on my Mac machine but getting the same error.
xcode version:9.2
ios version:11.2.6
Mac OS version:10.13.3
Appium server version:1.7.2
configuration which is required -
{
“platformName”: “iOS”,
“platformVersion”: “10.2.1",
“deviceName”: “------”,
“udid”: “fdbe0d55ced1fd6fa842681b6a058438573fb762",
“app”: “/Users/----/---/---/---.ipa”,
“automationName”: “XCUITest”
}
Based on app path, it will find the app to be loaded, also you have to provide the iOS version(XCode ios simulator version for simulator/ device OS version for device).
here is the iOS cap config,
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "iPhone");
capabilities.setCapability("platformName", "iOS");
capabilities.setCapability("automationName", "XCUITest");
capabilities.setCapability("udid", “******************************”);
capabilities.setCapability("bundleId”,”********”);
capabilities.setCapability("noReset", true);
capabilities.setCapability("app", “*******app path******“);
driver = new IOSDriver(new URL("http://0.0.0.0:4723/wd/hub"),capabilities);
please make sure the UDID you have mentioned it correct ,
and you do need to add "WebDriver Agent" app in your iOS device.

How to get Appium to target a real iOS device vs a simulator device

I am running on Appium 1.7.2 and using a iPhone 6s on 11.2.5 OS. I am trying to create a simple test to target a real iOS device vs a simulator but each time I run the code Appium/xCode will open a simulator and use that instead of the real device.
How do I get appium to use the real device. I have tried supplying the UUID of the device without luck.
Thank you,
Gradle
compile group: 'io.appium', name: 'java-client', version:'6.0.0-BETA2'
compile group: 'org.seleniumhq.selenium', name: 'selenium-server', version:'3.8.1'
compile group: 'org.seleniumhq.selenium', name: 'selenium-remote-driver', version:'3.8.1'
compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version:'3.8.1'
Java Code
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "iOS");
capabilities.setCapability("deviceName", "iPhone 6s");
capabilities.setCapability("platformVersion", "11.2");
//capabilities.setCapability("app", "https://s3.amazonaws.com/appium/TestApp8.4.app.zip");
capabilities.setCapability("browserName", "Safari");
capabilities.setCapability("uuid", "26deaa8eb5003b3d56a561ada2fcff2174b00df1");
capabilities.setCapability("deviceOrientation", "portrait");
capabilities.setCapability("browserName", "safari");
capabilities.setCapability("automationName", "XCUITest");
If you want to run Appium/XCUITest on real device, follow this guideline
The reason why appium takes simulator is that you did not provide xcodeOrgId & xcodeSigningId capabilities:
{
"xcodeOrgId": "<Team ID in apple dev account>",
"xcodeSigningId": "iPhone Developer"
}
You might face XCUITest xcodebuild exited with code '65', so follow the guide/search on stackoverflow how to fix setup manually.
Good luck!
To test ios real devices , below capabilities are required
app=${app}
version=${version}
platform=${platform}
deviceName=${deviceName}
udid=${udid}
platformName=${platformName}
newCommandTimeout=2500
name=${name}
automationName=${automationName}
xcodeOrgId=${xcodeOrgId}
xcodeSigningId=${xcodeSigningId}
usePrebuiltWDA=${usePrebuiltWDA}

Resources