I am a MacOS user, and I am trying to access a specific activity within an app (the app is the APK file). The emulator I am running from Android Studio is Pixel 3a XL. I have a Python client connected to the Appium server. I am using the Appium GUI server to run the code and using PyCharm to write the code. Prior to running the Appium GUI server, Android emulator, and PyCharm code, I was using a different APK file then switched to a new one. I typed in the command, 'appium-doctor --android' to verify that my environment variables and adb path is correct and there were checkmarks indicating that it was. After my PyCharm test failed, I used the terminal to install the emulator and received a new error stating that there is no such file or directory even though my path to my APK is correct.
Python Code:
from appium import webdriver
desired_capabilities = {
"deviceName": "Pixel_3a_XL",
"appPackage": "edu.psu.hhd.hdfs.jpm165.genericsurveyapp2",
"appActivity": ".SplashScreenActivity",
"platformName": "Android",
"app":"/Users/jkenglish/Desktop/Surge_Projects/app-debug-signed-2-22-22.apk"
}
#Driver Instance
webdriver.Remote("http://localhost:4723/wd/hub", desired_capabilities)
Terminal Command:
adb -s emulator-5554 install /Users/jkenglish/Desktop/Surge_Projects/app-debug-signed-2-22-2022.apk
Performing Streamed Install
adb: failed to stat /Users/jkenglish/Desktop/Surge_Projects/app-debug-signed-2-22-2022.apk: No such file or directory
It seems the file does not exist.
Run these
f='/Users/jkenglish/Desktop/Surge_Projects/app-debug-signed-2-22-2022.apk'
if [[ -e "$f" ]]
then
adb -s emulator-5554 install "$f"
else
printf 'ERROR: %s does not exist\n' "$f"
fi
Related
I am a MacOS user, and I am trying to access a specific activity within an app (the app is the APK file). The emulator I am running from Android Studio is Pixel 3a XL. I have a Python client connected to the Appium server. I am using the Appium GUI server to run the code and using PyCharm to write the code. Prior to running the Appium GUI server, Android emulator, and PyCharm code, I was using a different APK file then switched to a new one. I typed in the command, 'appium-doctor --android' to verify that my environment variables and adb is correct and there were checkmarks indicating that it was. After switching to an updated APK file, I received an error stating that the adb failed to install the APK. I also see an error that states 'Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE]'. Below are the error messages and code.
Here's the error messages:
Original error: Error executing adbExec. Original error: 'Command '/Users/jkenglish/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 install /Users/jkenglish/Desktop/Surge_Projects/app-debug-signed-2-21-22.apk' exited with code 1'; Stderr: 'adb: failed to install /Users/jkenglish/Desktop/Surge_Projects/app-debug-signed-2-21-22.apk: Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE]'; Code: '1'
Code:
from appium import webdriver
desired_capabilities = {
"deviceName": "Pixel_3a_XL",
"appPackage": "edu.psu.hhd.hdfs.jpm165.genericsurveyapp2",
"appActivity": ".SplashScreenActivity",
"platformName": "Android",
"app":"/Users/jkenglish/Desktop/Surge_Projects/app-debug-signed-2-21-22.apk"
}
#Driver Instance
webdriver.Remote("http://localhost:4723/wd/hub", desired_capabilities)
You can run this command on your emulator to verify the space left
$ adb shell su root df -h /data/app
outputs something like
Filesystem Size Used Avail Use% Mounted on
/dev/block/dm-5 XG xM YG p% /mnt/user/0/emulated/0/Android/obb
im on macbook old version El Capitan 10.11.6 and my python script is 147bytes just for auto shutdown program but when i try to boundle it pyinstaller filename.py it done almost everything and end up with (codesign failure). do someone know how to solve this?
Try the following command in your terminal, type: sudo codesign -f -s followed by your script name test.py Make sure you are in your script file directory by using cd path to your file folder.
After that, you can run pyinstaller test.py However, I am using macOS Monterey Version 12.6 and am not sure if it will work on your current version. In fact, I don't even know how that command makes it work, but it works for me. If your app is a windowed app, such as the Tkinter app, your system may prevent it from opening; in that case, use the following command to disable the security system sudo spctl --master-disable . then you will see a new option available in your macOS Settings under Security; down there it says Allow app from: App Store, App Store and identified developer; and at last, you will see a new option "Anywhere" which wasn't there before; check that, and your app will work perfectly. hope helped
Environment
Python 3.7
Mac OS Catalina 10.15
Problem
I am developing a software with Python for Mac OS X. I will compile it with Nuitka.
When I run my compiled program, it doesn't work.
When I was searching for solutions on Google, some people speak about checking the log system of the Mac OS.
So I found it here: Finder > Applications > Utilities > Console
The console is full of logs system messages. My problem is I don't know how can I filter all these logs to show only the ones connected to the execution of my software.
I use the logging module to create a log file for my python script but this log file is not produced. I guess program bug before it can create a log file.
Is there another way to check the logs?
Edit:
To compile my code, I execute this Nuitka command:
sudo python3 -m nuitka --standalone --plugin-enable=gevent --plugin-enable=qt-plugins --plugin-enable=pylint-warnings --show-progress --show-scons --follow-imports --recurse-all --windows-icon=phonebot_icon.icns MyApp.py
The result is 2 folders:
MyApp.build
MyApp.dist
MyApp.dist contains the executable file "MyApp" and some .so files.
From Finder, I can't browse MyApp.dist as it is seen as unknown file. So the only way to run the executable file is from terminal. I do:
sudo open MyApp
A new terminal window open and I get this output:
Last login: Thu Sep 3 12:46:32 on ttys001
/Users/gauthierbtz/Dropbox/cff/Python/MyApp/MyApp.dist/MyApp ; exit;
(base) gauthierbtz#MacBook-de-Gauthier ~ % /Users/gauthierbtz/Dropbox/cff/Python/MyApp/MyApp.dist/MyApp ; exit;
Password:
LSOpenURLsWithRole() failed for the application /Applications/MyApp.app with error -10810.
It looks like it try to go to Applications folder to open the MyApp.app which doesn't exist.
I am running some test on real Android device. I installed APpium server via pm. I can run Appium server with Windows command line 'appium'.
I try to start the appium server from my python code with these lines of code:
appium_service = AppiumService()
appium_service.start()
but nothing happened! I don't get any output, no error message, no exception, nothing.
So I tried again by passing some parameters:
appium_service = AppiumService()
appium_service.start(address='0.0.0.0', p='4723')
Again nothing happened!
It seems the code is waiting... or sleeping.... these lines of code are at the beginning of the script... I can see some logger messages for the initialization of my webdriver... but then nothing.
Is there anyone please who can help me to debug and to make run APpium server from my code without the command line os option.
First of all its good to check manually if "appium" command on shell launches the appium server or not(Seems in your case its working fine). In my case it was not with the installation of Appium desktop version. Posting the details of what i did to resolve this in case it helps someone:
Installed npm (as part of node installation, MSI available at nodejs.org)
npm install -g appium
Now to answer your main question, below is what i used in my Python script to start the appium server on a new window so that it runs separately from the rest of the script execution:
import os
os.system("start /B start cmd.exe #cmd /k appium")
In case you want to change the port(e.g. to 4728) of the appium server (may be when you have multiple servers for multiple devices) you can use following:
os.system("start /B start cmd.exe #cmd /k appium -a 127.0.0.1 -p 4728")
I have issue launching chrome Driver through jenkins but the same works in local machine. I am currently using chromedriver=2.9.248304 and platform=Linux - cent OS 6.
Please find my driver launching code below:
if(System.getProperty("os.name").contains("Linux"))
{
System.setProperty("webdriver.chrome.driver", "/opt/google/chrome/google-chromedriver");
glb_Webdriver_driver = new ChromeDriver();
}
i have added xvfb plugin to jenkins and installed in linux machine also for headless execution.
[1]: http://i.stack.imgur.com/iBdiC.png
Firefox driver is getting launched properly with headless execution on jenkins.
Please find the stack trace below:
61445 [2016-06-15 08:05:15,470] [ERROR][com.aem.genericutilities.CommonFunctions ] - Not able to open the Browser --- unknown error: Chrome failed to start: crashed
(Driver info: chromedriver=2.9.248304,platform=Linux 2.6.32-642.1.1.el6.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.47 seconds
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
Below are the steps which i used to download teh chromedriver in machine:
1- Download latest chrome using wget http://chrome.richardlloyd.org.uk/install_chrome.sh
chmod +x install_chrome.sh
sudo ./install_chrome.sh (u should run it as a root)
2) download latest chromedriver (2.9 onwards) ,lower versions will not work
3) copy chromedriver to /opt/google/chrome and change permission to 755
4) cd /opt/google/chrome
5) mv google-chrome google-chrome-standalone
6) cp chrome google-chrome
7) cp google-chrome-standalone google-chromedriver
8) open google-chromedriver in vi editor and change following line (last line in file )
exec -a "$0" "$HERE/chrome" "$#"
TO
exec -a "$0" "$HERE/chromedriver" "$#"
8) now replace existing symbolic links
First remove existing
sudo rm /usr/bin/chromedriver
sudo rm /usr/bin/google-chrome
Create new ones
sudo ln -s /opt/google/chrome/google-chromedriver /usr/bin/chromedriver
sudo ln -s /opt/google/chrome/google-chrome-standalone /usr/bin/google-chrome
You are really behind on ChromeDriver, and are apparently using the latest version of Chrome. Assuming you are running Chrome 51, you will need to be running ChromeDriver 2.22. See on the Google Group.