Appium Desktop cant start session error ENOTFOUND - appium

I am just trying to connect with my android emulator on the Windows machine, and I am trying for 4 hours. Tried reinstalling it with lower version 1.15, did not work either
1. Set up environment variables
2. Set up "Desired Capabilities" and press button "Start session". Getting error "ENOTFOUND"
{
"deviceName": "emulator-5554",
"platformName": "android",
"appPackage": "com.android.dialer",
"appActivity": ".main.impl.MainActivity",
"noReset": true
}
3. Message in console
EDIT:
Tried to find more info through starting java autotests.
appiumDriver = new AndroidDriver(new URL("http://localhost:4723/wd/hub"), desiredCapabilities);
Error screen log:
full log file https://www.dropbox.com/s/malyez6ejwk7p2f/appium-server-logs.txt?dl=0
EDIT2. Today I tried the same as what I did before but with another windows 10 machine and it was a successful result, but I still can't find out how to fix this problem on my main working machine.
It might be a silly mistake somewhere, but I really need help to point it out. Thank you.

Found answer here: https://stackoverflow.com/a/44204395/8877698
The problem was that I had the environment variable http_proxy

Some of the values are not set in capabilities. Also try opening all apps as administrator.
I got issues similar to yours solved by this.
"platformVersion": "8.0",
"automationName": "UiAutomator2"

Related

Appium inspector session is very slow (and hanging) when running a session on iOS real device

Scenario
I'm trying to run automated tests on an iOS real device, however, every time I start the Appium inspector session the client displays the app's loading page and never refreshes to update the inspector and display the home page.
Problem
When I manually press the refresh button on Appium the spinner gets displayed and takes a very long time to refresh the inspector. This happens on every interaction with the app.
Given
iOS real device: iPhone 12
iOS version: 15.1.1
Appium client: 1.15.0 and then tried 1.17.0
Capabilities Used
{
"platformName": "iOS",
"platformVersion": "15.1.1",
"deviceName": "iPhone 12",
"automationName": "XCUITest",
"autoAcceptAlerts": "true",
"bundleId": "com.xxxxx.xxxxx",
"xcodeOrgId": "xxxxxxxxxx",
"xcodeSigningId": "iPhone Developer",
"updatedWDABundleId": "com.facebook.WebDriverAgentRunner",
"app": "/{path-to-ipaFile}/appFile.ipa",
"udid": "xxxxxxxx-xxxxxxxxxxxxxxxx"
}
WebDriverAgent
Please note that the WebDriverAgent app is trusted (General -> VPN & Device Management).
You can find the logs here.
Appium Server Logs
You can find the logs here.
Failed Attempts for a Solution
Add to the capabilities "simpleIsVisibleCheck": "true" and "useJSONSource": "true"
Add to t he capabilities usePrebuiltWDA=true and derivedDataPath=/Users/myUserName/Library/Developer/Xcode/DerivedData/WebDriverAgent-
ciegwgvxzxdrqthilmrmczmqvrgu/
Run Appium server from CLI instead of Appium client
Unfortunately, none of the attempts worked.
NOTE: The same problem is occurring on simulator.
Turned out the getSession() function in Appium was taking too long to get a response due to a large table list, when I removed the items from the list Appium was fast again and getSession() was not taking a long time to get a response.

Calculator app does not open in Appium Inspector in Mac when launched iOS Simulator from it

I have been trying to launch Calculator app in Appium Inspector in my Mac Catalina using iOS Simulator but to no avail. I need to identify Calculator's actions/events to do some data driven testing. I was able to do so for Calendar using bundle ID com.apple.iCal but not so for Calculator with bundle ID com.apple.calculator. I am using below code:
{
"platformName": "iOS",
"automationName": "XCUITest",
"noReset": false,
"deviceName": "iPhone 11 Pro",
"platformVersion": "13.3",
"App Category": "Utilities",
"Bundle name": "Calculator",
"bundleId": "com.apple.calculator",
}
I get below error in Inspector though Simulator loads(err attachedenter image description here):
An unknown server-side error occurred while processing the command. Original error: App with bundle identifier 'com.apple.calculator' unknown
I have tried putting "/Applications/Calculator.app" value in "app" key but it results in:
An unknown server-side error occurred while processing the command. Original error: Bad app: /Applications/Calculator.app. App paths need to be absolute or an URL to a compressed app file: The application at '/Applications/Calculator.app' does not exist or is not accessible
Could somebody please look into this issue?
I have MacBook Pro Mac OS Catalina
Many Thanks!
The Calculator app is unavailable on iOS Simulator.
If you experiment with testing, try a different app like Settings or Shortcuts (you can create shortcuts to calculate things).
If you need to test the Calculator app, switch to testing with real devices.
Good luck!

--enable-precise-memory-info is not working on Mobile Chrome

Under the:
chrome://flags
I didn't find
--enable-precise-memory-info
Trying to run with:
ChromeOptions options = new ChromeOptions();
options.AddArguments("--enable-precise-memory-info");
also had no success, values are rounded.
Is it even possible?
Let me know if you need more details on this issue
Note: it's not about desktop, mobile chrome browse only!
One way of doing this is with adb
adb -s $deviceId shell am start -n com.android.chrome/com.google.android.apps.chrome.Main argv --args='--enable-precise-memory-info'
to obtain device id:
adb devices
But it wouldn't save flag for the next session, and if you are trying to open it with SeleniumWebDriver probably it should be done with DesiredCapabilities through adding ChromeOptions... but it's still a question how to do it
Currently an Appium 1.7.1 issue.
Follow fix progress here:
https://github.com/appium/appium/issues/9838

Error in using UIAutomatorviewer for testing Android app in Appium

I have to automate an Android application, I am doing the same through Appium.
The problem I am facing is after launching the Appium server, the app is getting installed in the emulator 4.4.2. To inspect the element I am using UIAutomatorviewer which comes default with SDK. But while inspecting the element of the app, I am getting the error:
Error obtaining UI hierarchy
Reason:Error while obtaining UI hierarchy XML file.com.android.ddmlb.SynchException.Remote object doesn't exist.
I tried to find the solution so that I can inspect the element so that I can script, but in vain.
Can someone please tell how to fix the issue so that I can inspect elements?
Is there any other way I can inspect element in the app apart from using UIAutomator viewer?
After my tryst with the uiautomator viewer i came to know that we get the error only when:
appium server is running and we try to capture the screenshot using uiautomatorviewer.
So, whenever you want to use uiautomatorviewer make sure that server is in stopped state.
I fixed the same issue by using following methods.
(1) Connect your Android device to your development machines;
(2) Go to command line in terminal or DOS command line for Windows;
(3) Using "adb shell" into your Android devices;
(4) Change the user to root by input "su root" in command line;
(5) Change the access right to /data/local/tmp by input "chmod 777 /data/local/tmp";
(6) Go back to uiautomatorviewer and do screen shot again, the error should be gone;
I guess there are some file can't be access if it doesn't own right in /data/local/tmp.
Make sure everything on your screen is static. And flashing input cursor is also not allowed. Any painting actions will stop uiautomator from dumping current UI.
You can test by using following adb command:
adb shell uiautomator dump /data/local/tmp/uidump.xml
if the message ERROR: could not get idle state. appears, you are suffering from this issue.
See lines 87 & 101 of DumpCommand:
try {
...
uiAutomation.waitForIdle(1000, 1000 * 10);
...
} catch (TimeoutException re) {
System.err.println("ERROR: could not get idle state.");
return;
}
Easiest solution..
Restart the device. Restart uiautomatorviewer.
Worked like a charm for me .... :P
Stop the Appium Server. Then try again. It works.
I had the same problem because I used "adbd insecure". So I just disabled "adbd insecure", and reload uiautomatorviewer, everything is OK.
In case of rooted devices: Enable the root access in developer options for adb. Restart adb as root
I have spent over a week to resolve this issue. When you connect your device and using ASM 3.0, when screen is projected open the UIAutomator to capture the current android screen. Without Appium it should capture. For use Android Studio instead of android sdk. Uninstall and reinstall Android Studio. It is working perfect for me now.
Answer to your question #2
You can inspect Android app directly from your real Android device.
You need to:
Connect Android device to your computer/laptop
Go to Android device Settings -> Enable Developer Options and Android debbuging
Please see here:
Start the app you wish to inspect in your Android device
Open up the Chrome browser on your computer/laptop and do a right click -> More Tools -> Inspect devices -> Click on your device -> (Click on Android device OK to authorize) -> Click Inspect
Please see here:
That's it. Hope it helps!
I got also the same issue (Also if Appium Server was not running). After switch, OFF / ON USB-Debugging was working for me.
I got it resolved
I closed the Appium Server running on my machine and opened it again.
Later open uiautomater, and it worked for me
The one that works is in this path:
Android/Sdk/tools/bin/uiautomatorviewer
Paste this in your terminal and it will run automator that works
we have to use device which has API level morethan 17 or jelly bean
Way to bypass the ERROR:
could not get idle state.
By using uiautomator to get uix and screenshot.
public class DeviceMethods extends UiAutomatorTestCase {
public void dump(){
try {
getUiDevice().dumpWindowHierarchy("window_dump.uix") ;
getUiDevice().takeScreenshot(new File("/data/local/tmp/window_dump.png"));
} catch (Exception e) {
}
}
you need to create the uiautomator jar and push it to /data/local/tmp
use this tutorial on how to use uiautomator
after you get the files just open them in uiautomatorviewer
What worked for me:
stop appium
open an emulator device (tested with Android 7.1.1)
go into settings > developer options > Enable view attribute inspection
open a shell on the computer, cmd or terminal depending on your OS
enter the following commands:
adb shell
su
cd /data
cd /local
chmod 777 tmp
start uiautomatorviewer
take an xml screenshot
"su chmod 777 /data/local/tmp" didnt work for me so I drilled down and it worked. I assume that you have to do this in an emulator and not a physical device unless the device is rooted. ¯ \ _ (ツ)_/¯
Lotsa Luck!
This happens because adb is using port and it's blocked by appium server.
I have found out best solution for this
Kill the adb.exe from taskbar processes and try launching uiautomatorviewer again
Check whether you have enabled these under "developer options" in the phone.
Verify apps via USB
View attribute inspection
USB debugging
1) stop appium Server
2) open an emulator device
3) go into settings > developer options > Enable view attribute inspection
4) developer options in invisible? Go into settings > Tap on About device/phone > Scroll down till the last option(Build number) > Continuously Tap on "Build number" for 7 times > you should get an Toast message "You're a developer" > come back from that screen > Go back into settings > Now you should see developer options Tap on it > Enable view attribute inspection
5) You should no more get this error message
Why don't you use appium inspector instead? You can download it and follow instructions from here
try switching Off and then ON the USB debugging option.. this work for me

Xcode Organizer - The service is invalid

I'm using XCode 4.3 (on Lion) and my iPod touch 2nd generation does show up, but displays "The service is invalid" (0xE8000022). I've tried every possible combination of restarting/reconnecting the device and have even restored the OS on the device... any ideas on how to further figure this out?
EDIT - initially I suggested restarting the device but I realized you had already done this.
I think this answer might be valid:
Error : The service is invalid

Resources