How to run Python Selenium script on Android device? - android

I have working Python script using Selenium (Windows), and I want run same script (with driver replacement) on android device. I found some info about Selendroid and Appium, but they seem to be used for connecting to Android devices, not to port code.
I'd be glad for help with this issue or some useful links to read about it.

Kivy Is the way do the thing which you want.
Kivy is the library which provides the platform to execute python, also kivy is open source so anyone can use that.
Github Link
Kivy Showcase link

Related

Developing Ruby on an Android tablet

I want to do Ruby development on an Android tablet, just like on any laptop. So, using vim, git, and rspec to run tests. So, I've found the following apps:
Vimtouch
Ruboto
Git (yes, it's an app)
Terminal Emulator (provides bash)
Each app works just fine. By itself. But, I don't know how to put it all together. I'm a bit of a newbie when it comes to how Android works. So, if anyone could help provide a writeup so that I can:
clone a github repository
edit files from that repository
run my tests
NOTE: I don't want to write an Android app. I want to use my tablet to do Ruby development.
The Android Scripting Environment said to plan on Ruby. Might be worth a check how far they got; at least they're tagged "JRuby" at Google Code. According to their project page:
Scripts can be run interactively in a terminal, in the background, or via Locale. Python, Perl, JRuby, Lua, BeanShell, JavaScript, Tcl, and shell are currently supported, and we're planning to add more.
this can be done
Compile Ruby and Nodejs for android
Install on device and configure with c/c++ ide (You can use
C4droid,CCTools,Terminal IDE.... for installing the expansion
modules on с/с++)

selenium android test scripts

I need to write selenium test scripts for an android app and test them using appium. I have so far written selenium test scripts for web applications where we perform "Inspect Element" to locate web elements and include them in our test scripts. But I have no idea how to locate the elements on the android app to write test scripts for it. Can anyone please tell me how to locate elements and write a selenium script for an android app???
Assuming you have Android SDK installed in you machine, please open uiautomatorviewer.bat file from /adt-bundle-windows-x86-20140702/sdk/tools and make sure that android app is running on the real device or mobile emulator. In order to start scripting for Mobile automation, you many want to refer the following link:Appium and Appium guide

Import python code in android project

I have a monitoring application that can be used to monitor devices using android. I currently have the code in python that I run from windows via ADB and get the results on windows in a CSV file.
I would like to create an android project that would behave as described above (an APK, in Java on eclipse), so I can run it without using ADB.
Is there a possibility that I can include the existing python code and call the methods from the old code (after installing the apk on an android device)?
Despite my online research - I could not get appropriate results. Can someone help me out here?
Thank you.
Did you check SL4A and Py4A ?
http://code.google.com/p/python-for-android/
You may check QPython too.

Python + Django on Android

I am a Django developer and wanted to know if anyone has any idea of the possibilities of installing and developing on Django using an Android tablet such as the nexus 7. This seems like a reasonably powerful device, can be hooked up with a bluetooth keyboard, and has linux at the core of the OS.
So - is it possible to install Python and Django (or even Flask) on Android?
Yeah! its posible!, but you need install termux terminal on Android and later open the termux terminal and write:
apt-update
apt-install python
pip install django
django-admin startproject demo
cd demo
python manage.py runserver 0.0.0.0:8000
and its all, open localhost:8000 on your browser, see the picture:
We're developing PythonAnywhere to fill just this kind of niche. We tuned it to work with the iPad first. But it seems that the Nexus 7 is popular enough now that there might be enough demand to do the same thing for Android.
SL4A is a ridiculously excellent library/sdk/app for android and gives you a way to install a number of language/scripting runtimes and a thin veneer for accessing android functionality via the scripting frameworks.
It so happens that Python is an option, and I've used it with cherrypy (python framework) on Android. I haven't tried it with flask or Django but with some work it should be possible.
The app provides a way to download python, install it, and then a way to launch a python console or even just run python scripts.
http://code.google.com/p/android-scripting/
There was a downside to the python support originally, due to a silly bug/limitation in the Android SDK. This restricted the use of apk assets with _ underscore in the name. The details are faint in my mind, but I am subscribed to the issue in Android so I can follow up with the details about this issue. This would present a problem with many of the python frameworks, as underscores are part of python style.
One good way to accomplish a django development environment on a Nexus7 is to install a linux distro with a package manager alongside Android. Debian Kit hooks into the existing Android directories with symlinks instead of a chroot environment.
With that you can install Debian or Ubuntu and use apt-get and pip to install git, virtualenv, and all the packages and libraries you need to set up your development environment as you would on a desktop. You can write your code in DroidEdit, run the django development server in an Android terminal through ssh to localhost, and test your app right there in the browser on Android.
I could run on my Tablet (android) and smartphone (android) following the procedure below:
Install "GNUroot Debian" app;
Open "GNUroot Debian" app;
Run these commands:
apt-get update
apt-get install python3
apt-get install python3-setuptools
easy_install3 pip
pip install django
django-admin startproject demo
cd demo
python manage.py runserver
QPython suports Django on Android. I am running it on my android device.
Do you want this? :
p.s: I confess that article's original source is me. But isn't it nice? :)
Well if your end goal is to develop Web applications and host host them on your Android and since you had flask there why not give bottle.py a shot. It's just one file that you copy into your sl4a scripts folder and voila. Bottle is minimalist and near similar to flask. No rooting or Unix environments required.
Install termux terminal on Android and later open the termux terminal and write:
pkg install python
pip install django
django-admin startproject demo
vim demo/demo/settings.py
In settings.py
ALLOWED_HOSTS = ['*']
After save the settings.py and
python manage.py runserver 0.0.0.0:8000
and its all, open localhost:8000 on your browser
If you are developing an android app and you don't want to use Java, you might want to consider Kivy http://kivy.org/#home
If you are talking about having a web server running on Android and then running your django web app on that web server itself, there's a duplicate answer here - Web Server for Android

Running a Python app on real Android phone

In order to develop an Android app using Python, I need to install Python for Android and SL4A on my computer to be used with the Android emulator. My question is, when I distribute this app to actual users/phones, do the phones need to get Python for Android and SL4A explicitly? Or is the supporting infrastructure built into Android devices? Or is there a way to package the Python application where the users do not have to get SL4A and Python for Android in order to run the application?
Instructions on redistributing your script to run on devices other than your development one are here:
http://code.google.com/p/android-scripting/wiki/SharingScripts
You can wrap them in a template project and build a stand alone apk.
Your users have to install SL4A and the language plugin (python?) on their phones, this is not a built-in functionality.
Since the source code is available, it's possible to create combined application, which includes your scripts and SL4A/python code, but in my opinion this defies the purpose of scripting in the first place.

Categories

Resources