Coder Social home page Coder Social logo

appium / appium-docker-android Goto Github PK

View Code? Open in Web Editor NEW
565.0 39.0 224.0 567 KB

Appium Server setup to automate android testing on real devices

Home Page: https://hub.docker.com/r/appium/

License: Other

Shell 60.66% Dockerfile 39.34%
android docker appium docker-container docker-image dockerfile docker-android docker-appium

appium-docker-android's Introduction

Stand With Ukraine

Appium

Cross-platform test automation for native, hybrid, mobile web and desktop apps.

NPM version Monthly Downloads FOSSA Status StandWithUkraine


Documentation | Get Started | Ecosystem | Changelog | Roadmap | Discussion Forum


Appium is an open-source automation framework that provides WebDriver-based automation possibilities for a wide range of different mobile, desktop and IoT platforms. Appium is modular and extensible, and supports multiple programming languages, which means there is an entire ecosystem of related software:

  • Drivers add support for automating specific platforms
  • Clients allow writing Appium tests in your programming language of choice
  • Plugins allow to further extend Appium functionality

Migrating From Appium 1 to Appium 2

As of January 1st, 2022, the Appium team no longer maintains or supports Appium 1. All officially supported platform drivers are only compatible with Appium 2.

Please read the Migration Guide if you are still using Appium 1.

Warning

If you use Appium Desktop or Appium Server GUI, you will not be able to upgrade to Appium 2, as both of these tools have been deprecated. Please use Appium Inspector in combination with a standalone Appium 2 server.

Installation

Appium can be installed using npm (other package managers are not currently supported). Please check the installation docs for the system requirements and further information.

If upgrading from Appium 1, make sure Appium 1 is fully uninstalled (npm uninstall -g appium). Unexpected errors might appear if this has not been done.

npm i -g appium

Note that this will only install the core Appium server, which cannot automate anything on its own. Please install drivers for your target platforms in order to automate them.

Drivers

Appium supports app automation across a variety of platforms, like iOS, Android, macOS, Windows, and more. Each platform is supported by one or more "drivers", which know how to automate that particular platform. You can find a full list of officially-supported and third-party drivers in Appium Ecosystem's Drivers page.

Driver management is done using Appium's Extension command-line interface:

# Install an official driver from npm (see documentation for a list of such drivers)
appium driver install <driver-name>
# Install any driver from npm
appium driver install --source=npm <driver-name>
# See documentation for installation from other sources

# List already installed drivers
appium driver list --installed
# Update a driver (it must be already installed)
# This will NOT update the major version, in order to prevent breaking changes
appium driver update <driver-name>
# Update a driver to the most recent version (may include breaking changes)
appium driver update <driver-name> --unsafe
# Uninstall a driver (it won't last forever, will it?)
appium driver uninstall <driver-name>

Clients

Client libraries enable writing Appium tests in different programming languages. There are officially-supported clients for Java, Python, Ruby, and .NET C#, as well as third-party clients for other languages. You can find a full list of clients in Appium Ecosystem's Clients page.

Plugins

Plugins allow you to extend server functionality without changing the server code. The main difference between drivers and plugins is that the latter must be explicitly enabled on Appium server startup (all installed drivers are enabled by default):

appium --use-plugins=<plugin-name>

You can find a full list of officially-supported and third-party plugins in Appium Ecosystem's Plugins page.

Similarly to drivers, plugin management is also done using Appium's Extension command-line interface:

# Install an official plugin from npm (see documentation for a list of such plugins)
appium plugin install <plugin-name>
# Install any plugin from npm
appium plugin install --source=npm <plugin-name>
# See documentation for installation from other sources

# List already installed plugins
appium plugin list --installed
# Update a plugin (it must be already installed)
# This will NOT update the major version, in order to prevent breaking changes
appium plugin update <plugin-name>
# Update a plugin to the most recent version (may include breaking changes)
appium plugin update <plugin-name> --unsafe
# Uninstall a plugin
appium plugin uninstall <plugin-name>

Server Command Line Interface

In order to start sending commands to the Appium server, it must be running on the URL and port where your client library expects it to listen. Appium's command-line interface is used to launch and configure the server:

# Start the server on the default host (0.0.0.0) and port (4723)
appium server
# You can also omit the 'server' subcommand
appium
# Start the server on the given host, port and use a custom base path prefix (the default prefix is '/')
appium --address 127.0.0.1 --port 9000 --base-path /wd/hub

Appium supports execution of parallel server processes, as well as parallel driver sessions within a single server process. Refer the corresponding driver documentations regarding which mode is optimal for the particular driver or whether it supports parallel sessions.

Why Appium?

  1. You usually don't have to recompile your app or modify it in any way, due to the use of standard automation APIs on all platforms.
  2. You can write tests with your favorite dev tools using any WebDriver-compatible language such as Java, Python, Ruby and C#. There are also third party client implementations for other languages.
  3. You can use any testing framework.
  4. Some drivers like xcuitest and uiautomator2 have built-in mobile web and hybrid app support. Within the same script, you can switch seamlessly between native app automation and webview automation, all using the WebDriver model that's already the standard for web automation.
  5. You can run your automated tests locally and in a cloud. There are multiple cloud providers that support various Appium drivers (mostly targeting iOS and Android mobile automation).
  6. Appium Inspector can be used to visually inspect the page source of applications across different platforms, facilitating easier test development.

Investing in the WebDriver protocol means you are betting on a single, free, and open protocol for testing that has become a web standard. Don't lock yourself into a proprietary stack.

For example, if you use Apple's XCUITest library without Appium, you can only write tests using Obj-C/Swift, and you can only run tests through Xcode. Similarly, with Google's UiAutomator or Espresso, you can only write tests in Java/Kotlin. Appium opens up the possibility of true cross-platform native app automation, for mobile and beyond!

If you are looking for a more comprehensive description of what this is all about, please read our documentation on How Does Appium Work?.

License

Apache-2.0

FOSSA Status

appium-docker-android's People

Contributors

0penth3wind0w avatar andrcuns avatar arthurhd avatar budtmo avatar davirss avatar diemol avatar eyeojeff avatar irfanahmadein avatar jlipps avatar megolee avatar patrickduncan avatar pr4bh4sh avatar ranitdey avatar rarrouas avatar red-avtovo avatar rzrnt avatar saikrishna321 avatar srinivasantarget avatar vikramvi avatar weihongliang233 avatar xuanzhaopeng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

appium-docker-android's Issues

Error start session: Appium 1.9.0 + docker container

The problem

Hi! I wanna perform my test in parallel at some devices with docker. I launched docker container, which sees only 1 necessary device. But when I try to create appium driver I receive "[GET http://localhost:8200/wd/hub/status] with no body" error.

Environment

Appium version Appium v1.9.1
Desktop OS/version used to run Appium: 16.04.1-Ubuntu
Node.js version: 6.4.1
Mobile platform/version under test: Android 7.0
Real device or emulator/simulator: Real device
Docker container: docker pull appium/appium (with updated appium and node.js)
https://hub.docker.com/r/appium/appium/
Link to Appium logs

https://gist.github.com/aikuznetsov/50abddf6dfc0ea9a04fdb5a704c66f05

Code To Reproduce Issue [ Good To Have ]

Start docker container: docker run --rm -d --device /dev/bus/usb/003/075:/dev/bus/usb/003/075 -v ~/.android:/root/.android --name device1 appium/appium

Attempt to create driver:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", deviceID);
capabilities.setCapability("model", "SM_A310F");
capabilities.setCapability("udid", deviceID);
capabilities.setCapability("automationName", "uiautomator2");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "7.0");
capabilities.setCapability("newCommandTimeout", "0");
capabilities.setCapability("appPackage", HOTSPOTSHIELD);
capabilities.setCapability("appActivity", HSS_MAIN_ACTIVITY);

Cannot run adb command

docker-machine --version

0.11.0

Create docker

docker-machine create --driver vmwarefusion appium-test-machine

Get appium/appium

docker@appium-test-machine:~$ docker run --privileged -d -p 4723:4723  -v /dev/bus/usb:/dev/bus/usb --name container-appium appium/appium
Unable to find image 'appium/appium:latest' locally
latest: Pulling from appium/appium
bd97b43c27e3: Pull complete 
6960dc1aba18: Pull complete 
2b61829b0db5: Pull complete 
1f88dc826b14: Pull complete 
73b3859b1e43: Pull complete 
6c8edd7bef99: Pull complete 
92bcf1dd83d3: Pull complete 
fd1899cf6bd3: Pull complete 
52a115f9495b: Pull complete 
3ec5d10ba228: Pull complete 
d537468e7c38: Pull complete 
4ef145e4c267: Pull complete 
a6b1588c78cf: Pull complete 
Digest: sha256:4dfb8854f1df95d3090ba8b7fb3eb4e07ee06878f2c8ec0e5778de3fe7f426a6
Status: Downloaded newer image for appium/appium:latest
c30d10172588807e3c28587a5e770d5d9aaa4b01160173369e695424d0ecd859
docker@appium-test-machine:~$ docker exec -it container-appium bash "adb"
/root/platform-tools/adb: /root/platform-tools/adb: cannot execute binary file

Could u have a look why I cannot execute adb? Is it because I use VMFusion?

Device Not Shown

I tried to execute command : docker exec -it container-appium adb devices and it doesn't show up any devices
docker@appium-test-machine:~$ docker exec -it container-appium adb devices
List of devices attached

It only shows List of devices attached and nothing else.
Can you please help how can it would be available.?

RequestError: Error: socket hang up at new RequestError (/usr/lib/node_modules/appium/node_modules/request-promise-core/lib/errors.js:14:15)

## Adding the NodeSource signing key to your keyring...

+ curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
Warning: apt-key output should not be parsed (stdout is not a terminal)
OK

## Creating apt sources list file for the NodeSource Node.js 10.x repo...

+ echo 'deb https://deb.nodesource.com/node_10.x bionic main' > /etc/apt/sources.list.d/nodesource.list
+ echo 'deb-src https://deb.nodesource.com/node_10.x bionic main' >> /etc/apt/sources.list.d/nodesource.list

## Running `apt-get update` for you...

+ apt-get update
Get:1 https://deb.nodesource.com/node_10.x bionic InRelease [4584 B]
Hit:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:3 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:4 https://deb.nodesource.com/node_10.x bionic/main amd64 Packages [767 B]
Hit:5 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:6 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Fetched 5351 B in 1s (3607 B/s)
Reading package lists...

## Run `sudo apt-get install -y nodejs` to install Node.js 10.x and npm
## You may also need development tools to build native addons:
     sudo apt-get install gcc g++ make
## To install the Yarn package manager, run:
     curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
     echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
     sudo apt-get update && sudo apt-get install yarn


debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libpython2.7-minimal:amd64.
(Reading database ... 27305 files and directories currently installed.)
Preparing to unpack .../0-libpython2.7-minimal_2.7.15~rc1-1ubuntu0.1_amd64.deb ...
Unpacking libpython2.7-minimal:amd64 (2.7.15~rc1-1ubuntu0.1) ...
Selecting previously unselected package python2.7-minimal.
Preparing to unpack .../1-python2.7-minimal_2.7.15~rc1-1ubuntu0.1_amd64.deb ...
Unpacking python2.7-minimal (2.7.15~rc1-1ubuntu0.1) ...
Selecting previously unselected package python-minimal.
Preparing to unpack .../2-python-minimal_2.7.15~rc1-1_amd64.deb ...
Unpacking python-minimal (2.7.15~rc1-1) ...
Selecting previously unselected package libpython2.7-stdlib:amd64.
Preparing to unpack .../3-libpython2.7-stdlib_2.7.15~rc1-1ubuntu0.1_amd64.deb ...
Unpacking libpython2.7-stdlib:amd64 (2.7.15~rc1-1ubuntu0.1) ...
Selecting previously unselected package python2.7.
Preparing to unpack .../4-python2.7_2.7.15~rc1-1ubuntu0.1_amd64.deb ...
Unpacking python2.7 (2.7.15~rc1-1ubuntu0.1) ...
Selecting previously unselected package libpython-stdlib:amd64.
Preparing to unpack .../5-libpython-stdlib_2.7.15~rc1-1_amd64.deb ...
Unpacking libpython-stdlib:amd64 (2.7.15~rc1-1) ...
Setting up libpython2.7-minimal:amd64 (2.7.15~rc1-1ubuntu0.1) ...
Setting up python2.7-minimal (2.7.15~rc1-1ubuntu0.1) ...
Setting up python-minimal (2.7.15~rc1-1) ...
Selecting previously unselected package python.
(Reading database ... 28053 files and directories currently installed.)
Preparing to unpack .../python_2.7.15~rc1-1_amd64.deb ...
Unpacking python (2.7.15~rc1-1) ...
Selecting previously unselected package nodejs.
Preparing to unpack .../nodejs_10.15.3-1nodesource1_amd64.deb ...
Unpacking nodejs (10.15.3-1nodesource1) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Setting up nodejs (10.15.3-1nodesource1) ...
Setting up libpython2.7-stdlib:amd64 (2.7.15~rc1-1ubuntu0.1) ...
Setting up python2.7 (2.7.15~rc1-1ubuntu0.1) ...
Setting up libpython-stdlib:amd64 (2.7.15~rc1-1) ...
Setting up python (2.7.15~rc1-1) ...
npm WARN deprecated [email protected]: Moved to appium-android-driver
npm WARN deprecated [email protected]: Moved to io.appium.settings
npm WARN deprecated [email protected]: Moved to io.appium.settings
npm WARN deprecated [email protected]: core-js@<2.6.5 is no longer maintained. Please, upgrade to core-js@3 or at least to actual
version of core-js@2.
npm WARN deprecated [email protected]: Moved to appium-android-bootstrap
npm WARN deprecated [email protected]: cross-spawn no longer requires a build toolchain, use it instead
/usr/bin/appium -> /usr/lib/node_modules/appium/build/lib/main.js

> [email protected] install /usr/lib/node_modules/appium/node_modules/appium-chromedriver
> node install-npm.js

info Chromedriver Install Installing Chromedriver version '2.37' for platform 'linux' and architecture '64'
info Chromedriver Install Opening temp file to write chromedriver_linux64 to...
info Chromedriver Install Downloading https://chromedriver.storage.googleapis.com/2.37/chromedriver_linux64.zip...
RequestError: Error: socket hang up
    at new RequestError (/usr/lib/node_modules/appium/node_modules/request-promise-core/lib/errors.js:14:15)
    at Request.plumbing.callback (/usr/lib/node_modules/appium/node_modules/request-promise-core/lib/plumbing.js:87:29)
    at Request.RP$callback [as _callback] (/usr/lib/node_modules/appium/node_modules/request-promise-core/lib/plumbing.js:46:31)
    at self.callback (/usr/lib/node_modules/appium/node_modules/request/request.js:185:22)
    at Request.emit (events.js:189:13)
    at Request.onRequestError (/usr/lib/node_modules/appium/node_modules/request/request.js:881:8)
    at ClientRequest.emit (events.js:189:13)
    at TLSSocket.socketOnEnd (_http_client.js:426:9)
    at TLSSocket.emit (events.js:194:15)
    at endReadableNT (_stream_readable.js:1125:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/appium/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node install-npm.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-04-05T01_26_12_153Z-debug.log
The command '/bin/sh -c curl -sL https://deb.nodesource.com/setup_10.x | bash &&     apt-get -qqy install nodejs &&     npm install -g appium@${APPIUM_VERSION} --unsafe-perm=true --allow-root &&     exit 0 &&     npm cache clean &&     apt-get remove --purge -y npm &&     apt-get autoremove --purge -y &&     rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* &&     apt-get clean'
returned a non-zero code: 1
PS D:\Documents\code\docker\appium\appium-docker-android>

Not able to run the docker image step 8

I am new to docker and following the steps exactly as mentioned in the doc. I am successful till mounting my Android USB device. When i run this command

docker run --privileged -d -p 4723:4723 -v /dev/bus/usb:/dev/bus/usb --name container-appium appium/appium

i am getting this issue

9938ae1e839c5575963eaed5128c6569d9706aafa877dbcd74b2a6948748ba2d docker: Error response from daemon: Mounts denied: The path /dev/bus/usb is not shared from OS X and is not known to Docker. You can configure shared paths from Docker -> Preferences... -> File Sharing. See https://docs.docker.com/docker-for-mac/osxfs/#namespaces for more info. . and i am using mac sierra. Thanks for your help

Adb server freeze when run test in parallel in Docker for Mac + USB 2.0 controller

I just start this topic when you start one docker-machine with multiple appium-docker-android containers , and run test in parallel

I found adb server will freeze just after several run when u start test in multiple containers. However I cannot figure out the reason...

I'd like to know whether you guys maybe also found this problem.

PS: when u run test only in ONE container, it works perfect.

boot android emulator on container up

Currently booting the container does not bring up android emulator

[saikrisv@insaikrisv-2 Desktop ]$ docker exec -it d4ba0f64b861 bash
root@d4ba0f64b861:/opt/node# appium -v
1.6.3
root@d4ba0f64b861:/opt/node# adb devices
List of devices attached
* daemon not running. starting it now on port 5037 *
* daemon started successfully *

root@d4ba0f64b861:/opt/node# adb devices
List of devices attached

root@d4ba0f64b861:/opt/node#

Android real device:app need permission(like location、carmera、root... ) every times for running not only frist-run

The problem
desired_caps['noreset']=True
desired_caps['appPackage']=''
desired_caps['appActivity']=
"
I got configure the script like this,also grant the permission like location or root or carmera with hand operation after frist running app.
But,it always need permission when run app for second or third or more times

Environment
1、Android mobile:Mi 8
2、Appium Docker for Android

Details
My confused
1、Whatever app have to request the system permission every times for appium automation test with real device?(The app was already installed in the device for hand operation)
2、If the answer is ‘yes’,how can i allow all the permission like root、location、call... with using webdriver Element localization

running simple example to test appium docker

Hi ,
i am pretty new with dockers but working with appium a long time, what i am trying to do is to run appium through docker with usb , i install what i needed with your code (create a hub on selenium grid and node with node js , in ports 4444 and 4723 as usual) , i create java project that contain the creation of the instance , here is a snippet of the code :

public static void main(String[] args) throws MalformedURLException {

    DesiredCapabilities capabilities = new DesiredCapabilities();

    capabilities.setCapability("deviceName","Android");
    capabilities.setCapability("app","app-debug.apk");
    capabilities.setCapability("platformName","Android");
    capabilities.setCapability("platformVersion","5.0");
    capabilities.setCapability("appWaitPackage","com.***.****");   
    capabilities.setCapability("appWaitActivity","com.***.***.***.****");

    AndroidDriver driver = new AndroidDriver<MobileElement>(new 
                                                                    URL("http://127.17.0.3:4723/wd/hub"),capabilities);
}

i create a new docker that run the java jar that created after compile the project

FROM java:8
EXPOSE 8080
ADD /target/test-1.0-SNAPSHOT.jar test-1.0-SNAPSHOT.jar
ADD /target/lib/ /lib/
ADD app-debug.apk app-debug.apk
ENTRYPOINT ["java","-jar","test-1.0-SNAPSHOT.jar"]

when i running the code with expose to the port 8080 , i get connect refuse .. can you advise ?

Exception in thread "main" org.openqa.selenium.WebDriverException: org.apache.http.conn.HttpHostConnectException: Connect to 127.17.0.3:4723 [/127.17.0.3] failed: Connection refused: connect
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info host: '4bb330d0f54c' , ip: '172.17.0.3 , os.name: 'Linux' , os.arch: 'amd64' , os.version: '4.4.104-boot2docker' , java.version: '1.8.0._111'
Driver info: driver.version: AndroidDriver
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:177)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:250)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:137)
at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:38)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:88)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:112)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:73)
at main.main(main.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to 127.17.0.3:4723 [/127.17.0.3] failed: Connection refused: connect
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:159)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:359)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:381)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:237)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:139)
at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:87)
at io.appium.java_client.remote.AppiumProtocolHandShake.createSession(AppiumProtocolHandShake.java:114)
at io.appium.java_client.remote.AppiumProtocolHandShake.createSession(AppiumProtocolHandShake.java:76)
at io.appium.java_client.remote.AppiumCommandExecutor.doExecute(AppiumCommandExecutor.java:111)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:162)
... 17 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:75)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
... 32 more

issue after restarting the container

Once after restart the docker image - appium-test-machine,
And perform adb devices, docker exec -it container-appium adb devices
I am getting.
Error response from daemon: Container 79c6625c09eb91fcf98521f20fbec3f1bd4d679ab82a9728c0d0e8d2e3ca8a39 is not running
How to fix this ?

[Question] Not able to run docker image step 9

Hello,

Everything until step8 worked smooth but it seems i cannot pass step 9.

I moved to docker image and get the ip:

docker@appium-test-machine:~$ docker inspect $(docker ps -q) | grep IPA
            "SecondaryIPAddresses": null,
            "IPAddress": "172.17.0.2",
                    "IPAMConfig": null,
                    "IPAddress": "172.17.0.2",
docker@appium-test-machine:~$  

But when i add it to my tests i cannot run my demo test:

        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Pixel2");
        capabilities.setCapability(MobileCapabilityType.APP, "/opt/sdk.apk");
        androidDriver = new AndroidDriver<MobileElement>(new URL("http://172.17.0.2:4723/wd/hub"), capabilities);
org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Original error: Failed to connect to /172.17.0.2:4723
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'Lucians-MacBook.local', ip: '172.16.118.39', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.2', java.version: '1.8.0_144'
Driver info: driver.version: AndroidDriver

What i am missing? until here works as expected.

Thank you in advance.

Device offline

Hallo! When I try to connect a device, I fail, and the device changes the port. While I can not understand the reason, the version of the container with the earlier version works fine.

appium/appium:latest
root@928b6be7f7ae:~# adb connect 34.148.34.58:7437
failed to authenticate to 34.148.54.28:7437

root@928b6be7f7ae:~# adb devices
List of devices attached
34.148.54.28::7437 offline

Unable to query screen elements

I am using the appium-docker-android tool to run my tests and when I am running them, I am not able to query for screen elements. It always fails during this portion. Is anyone else having similar issues?

Bootstrap socket crash

Hi Budi,
Firstly i want to thanks you for amazing documents, I registered multiple devices on one container and
When I run tests, i get error message:
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Android bootstrap socket crashed: Error: This socket has been ended by the other party

Please help me.how Can i solve this issue

Thanks a lot

Running the container

Do we need to run docker run --privileged -d -p 4723:4723 -v /dev/bus/usb:/dev/bus/usb --name container-appium appium/appium every time before starting the automation ?

Optimize the dockerFile

  • Reduce the Android API's to latest 4 or 5 version
  • Eliminate Ant
  • Install Node (probably latest) directly
  • PATH setup [Environment variable's]
  • Reduce image Size (Currently it is > 3GB)
  • Expose all port's

Not finding my android device

hi,
please take a look at my docker compose file:

`
appium-android:
image: appium/appium
privileged: true
container_name: appium
volumes:
- /Volumes:/dev/bus/usb
- ./app/1media.apk:/app/1media.apk
- ~/.android:/root/.android
ports:
- 4723:4723

java-maven:
image: iamranit/appiumdockertest:3.0.0
container_name: appiumdockertest
volumes:
- /Users/ranit/Downloads/Result:/test-output/

command: ptest -p config.ini -t test-ui
links:
- appium-android:localhost

`

with this when I am running the docker compose file , everything is working properly except its not finding my android device. Error wile running:

Starting appium ... done Starting appiumdockertest ... done Attaching to appium, appiumdockertest appium | [Appium] Appium support for versions of node < 8 has been deprecated and will be removed in a future version. Please upgrade! appium | [Appium] Welcome to Appium v1.8.1 appium | [Appium] Non-default server args: appium | [Appium] log: /var/log/appium.log appium | [Appium] Appium REST http interface listener started on 0.0.0.0:4723 appium | [HTTP] --> POST /wd/hub/session appium | [HTTP] {"capabilities":{"alwaysMatch":{"appium:deviceName":"Android","appium:app":"/app/1media.apk","appium:autoGrantPermissions":"true","platformName":"Android","appium:automationName":"uiautomator2"},"firstMatch":[{}]},"desiredCapabilities":{"deviceName":"Android","app":"/app/1media.apk","platformName":"Android","automationName":"uiautomator2","autoGrantPermissions":"true"}} appium | [debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"deviceName":"Android","app":"/app/1media.apk","platformName":"Android","automationName":"uiautomator2","autoGrantPermissions":"true"},null,{"alwaysMatch":{"appium:deviceName":"Android","appium:app":"/app/1media.apk","appium:autoGrantPermissions":"true","platformName":"Android","appium:automationName":"uiautomator2"},"firstMatch":[{}]}] appium | [debug] [BaseDriver] Event 'newSessionRequested' logged at 1534157095987 (03:44:55 GMT-0700 (PDT)) appium | [Appium] Creating new AndroidUiautomator2Driver (v1.12.0) session appium | [Appium] Capabilities: appium | [Appium] platformName: Android appium | [Appium] deviceName: Android appium | [Appium] app: /app/1media.apk appium | [Appium] autoGrantPermissions: true appium | [Appium] automationName: uiautomator2 appium | [debug] [BaseDriver] W3C capabilities {"alwaysMatch":{"platformNa... and MJSONWP desired capabilities [object Object] were provided appium | [debug] [BaseDriver] Creating session with W3C capabilities: {"alwaysMatch":{"platformNa... appium | [BaseDriver] Boolean capability passed in as string. Functionality may be compromised. appium | [BaseDriver] Capability 'autoGrantPermissions' changed from string to boolean. This may cause unexpected behavior appium | [BaseDriver] Session created with session id: dd90abaa-e9ba-4411-9e54-a33b9aaa2ac9 appium | [BaseDriver] Using local app '/app/1media.apk' appium | [debug] [UiAutomator2] Checking whether app is actually present appium | [debug] [AndroidDriver] Getting Java version appium | [AndroidDriver] Java version is: 1.8.0_171 appium | [ADB] Checking whether adb is present appium | [ADB] Found 1 'build-tools' folders under '/root' (newest first): appium | [ADB] /root/build-tools/28.0.0 appium | [ADB] Using adb from /root/platform-tools/adb appium | [AndroidDriver] Retrieving device list appium | [debug] [ADB] Trying to find a connected android device appium | [debug] [ADB] Getting connected devices... appium | [debug] [ADB] 0 device(s) connected appium | [debug] [ADB] Could not find devices, restarting adb server... appium | [debug] [ADB] Restarting adb appium | [debug] [ADB] Killing adb server on port 5037 appium | [debug] [ADB] Getting connected devices... appium | [debug] [ADB] 0 device(s) connected appium | [debug] [ADB] Could not find devices, restarting adb server... appium | [debug] [ADB] Restarting adb appium | [debug] [ADB] Killing adb server on port 5037 appium | [debug] [ADB] Getting connected devices... appium | [debug] [ADB] 0 device(s) connected appium | [debug] [ADB] Could not find devices, restarting adb server... appium | [debug] [ADB] Restarting adb appium | [debug] [ADB] Killing adb server on port 5037 appium | [debug] [ADB] Getting connected devices... appium | [debug] [ADB] 0 device(s) connected appium | [debug] [ADB] Could not find devices, restarting adb server... appium | [debug] [ADB] Restarting adb appium | [debug] [ADB] Killing adb server on port 5037 appium | [debug] [ADB] Getting connected devices... appium | [debug] [ADB] 0 device(s) connected appium | [debug] [ADB] Could not find devices, restarting adb server... appium | [debug] [ADB] Restarting adb appium | [debug] [ADB] Killing adb server on port 5037 appium | [debug] [ADB] Getting connected devices... appium | [debug] [ADB] 0 device(s) connected appium | [debug] [ADB] Could not find devices, restarting adb server... appium | [debug] [ADB] Restarting adb appium | [debug] [ADB] Killing adb server on port 5037 appium | [debug] [ADB] Getting connected devices... appium | [debug] [ADB] 0 device(s) connected appium | [debug] [ADB] Could not find devices, restarting adb server... appium | [debug] [ADB] Restarting adb appium | [debug] [ADB] Killing adb server on port 5037 appium | [debug] [ADB] Could not find devices, restarting adb server... appium | [debug] [ADB] Restarting adb appium | [debug] [ADB] Killing adb server on port 5037 appium | [debug] [ADB] Could not find devices, restarting adb server... appium | [debug] [ADB] Restarting adb appium | [debug] [ADB] Killing adb server on port 5037 appium | [debug] [ADB] Could not find devices, restarting adb server... appium | [debug] [ADB] Restarting adb appium | [debug] [ADB] Killing adb server on port 5037 appium | [debug] [ADB] Could not find devices, restarting adb server... appium | [debug] [ADB] Restarting adb appium | [debug] [ADB] Killing adb server on port 5037 appium | [debug] [ADB] Could not find devices, restarting adb server... appium | [debug] [ADB] Restarting adb appium | [debug] [ADB] Killing adb server on port 5037 appium | [debug] [ADB] Could not find devices, restarting adb server... appium | [debug] [ADB] Restarting adb

any help?

Unable to copy .apk file inside container-appium

I am able to perform,
docker cp /Users/loacl-macosx-path-to-apk/app-debug.apk container-appium:/opt
Above command doesnot give me any error response, but if navigate to

opt$ 
docker@appium-test-machine:/opt$ ls -l
total 20
-rwxr-xr-x    1 root     root            51 Jul 19 18:33 bootlocal.sh
-rwxr-xr-x    1 root     root          2383 Dec 10  2017 bootscript.sh
-rwxr-xr-x    1 root     root           286 Jan  5  2017 bootsync.sh
-rwxr-xr-x    1 root     root           137 Jan  5  2017 shutdown.sh
-rw-rw-r--    1 root     staff           31 Jul 19 18:33 tcemirror

I am not finding my apk file there. Is this expected ?

Need Info - Why to use this and its benefits

Can you please add details about merits of using this over existing approach ?

e.g. In case of web automation, with Docker approach one can create in house grid setup on single powerful box to run test cases in parallel mode.

Similar clarification can be helpful.

Run on the Windows OS

Hello,
Am completely new to the dockers when am trying to run dockers compose with the following yml file
`version: '2'

services:

Selenium hub

selenium_hub:
image: selenium/hub
ports:
- 4444:4444

Appium Docker Android

appium_android_device:
image: appium/appium
depends_on:
- selenium_hub
privileged: true
volumes:
- /dev/bus/usb:/dev/bus/usb
- ~/.android:/root/.android
environment:
- CONNECT_TO_GRID=true
- SELENIUM_HOST=selenium_hub
# Enable it for msite testing
#- BROWSER_NAME=chrome`

ERROR

ERROR: for appiumrequired_appium_android_device_1 Cannot create container for service appium_android_device: b'Mount denied:\nThe source path "\\dev\\bus\\usb:/dev/bus/usb"\nis not a valid Windows path'

ERROR: for appium_android_device Cannot create container for service appium_android_device: b'Mount denied:\nThe source path "\\dev\\bus\\usb:/dev/bus/usb"\nis not a valid Windows path'
ERROR: Encountered errors while bringing up the project.

Complete log

PS C:\Users\DELL\Desktop\Appium Required> docker-compose up -d
Starting appiumrequired_selenium_hub_1 ... done
Creating appiumrequired_appium_android_device_1 ... error

ERROR: for appiumrequired_appium_android_device_1 Cannot create container for service appium_android_device: b'Mount denied:\nThe source path "\\dev\\bus\\usb:/dev/bus/usb"\nis not a valid Windows path'

ERROR: for appium_android_device Cannot create container for service appium_android_device: b'Mount denied:\nThe source path "\\dev\\bus\\usb:/dev/bus/usb"\nis not a valid Windows path'
ERROR: Encountered errors while bringing up the project.

Question, Connect Each Device to a Separate Container

Hi,
I have connect 3 devices to the host.
But unfortunately, i didn't success to find the devices when i ssh to the container, just find the first device.

May it related to the command:
$ docker run -d -p 4723:4723 --device /dev/bus/usb/XXX/YYY:/dev/bus/usb/XXX/YYY -v ~/.android:/root/.android --name device1 appium/appium

What is the XXX/YYY ? can anyone help me ?
How i can recognize the local USB to share it with the docker ?

Here is my usb connected devices to the virtual box:
screen shot 2018-07-01 at 12 10 32 pm

Thanks,

Need info

Why do we mount - "~/.android:/root/.android". I was wondering what's actually happening here, I am a bit unsure of its use. The container seems to perfectly run my tests without it.

an X display is required for keycode conversions

Looks like xvfb is still needed when running tests with chromedriver even on real device. Here is the error I get:

[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"79836eb8083f234038177a3804fb0282","status":13,"value":{"message":"unknown error: an X display is required for keycode conversions, consider using Xvfb\n  (Session info: chrome=58.0.3029.83)\n  (Driver info: chromedriver=2.28.455506 (18f6627e265f442aeec9b6661a49fe819aeeea1f),platform=Linux 4.11.2-1-ARCH x86_64)"}}

The issue is mentioned here. I created a fix based on solution mentioned in linked issue, will add PR shortly.

Unable to connect to 2 real devices

Hi,
Could you have a look.

I'm using your docker-compose file to start appium docker https://github.com/appium/appium-docker-android/blob/master/examples/docker-compose.yml.

I connect 2 real devices and I start the docker-compose file like this:
docker-compose up -d --scale appium_android_device=2
When I check the selenium grid server, one container receives 2 devices while the other receives no device.
When I run test, one container is crashed with this message:
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Android bootstrap socket crashed: Error: This socket has been ended by the other party

Please help me.

Thanks.

use the adb from anther container

The appium is running in container-appium
docker run --privileged -d -p 4723:4723 -v /dev/bus/usb:/dev/bus/usb --name container-appium appium/appium

I understand it will start an adb server in the container,
however is it possible to use the adb outside of this container for example use the adb server running in the physic machine(ubuntu 18.04)?

Move bats installation and test scripts outside of final docker image

I propose to remove bats installation and copying of tests directory inside container in favor of adding bats as submodule in repo and only mounting tests dir instead of copying it permanently.
While it doesn't add much difference megabyte wise, it does keep Dockerfile and container a little bit cleaner and without only integration test specific stuff. WDYT? @SrinivasanTarget @butomo1989

docker build failing now after broken udev-rules url

docker build failing on master with below error message

https://raw.githubusercontent.com/M0Rf30/android-udev-rules/ubuntu/master/51-android.rules:
2017-02-04 16:39:12 ERROR 404: Not Found.
The command '/bin/sh -c mkdir /etc/udev/rules.d   && wget --no-verbose $UDEV_REMOTE_FILE -O /etc/udev/rules.d/51-android.rules' returned a non-zero code: 8

reason : android-udev-rules remote file is removed at M0Rf30/android-udev-rules@2010aef

Failed to establish a new connection Error

I am getting MaxRetryError: HTTPConnectionPool(host='192.168.99.100', port=4723): Max retries exceeded with url: /wd/hub/session (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x106cdea90>: Failed to establish a new connection: [Errno 61] Connection refused',))
While running the my automation suite.

Cannot figure out why it is unable to auto connect android device by air

Hey,

docker-machine version 0.11.0

Following command doesn't work:

docker run -d -t -i -e REMOTE_ADB=True -e ANDROID_DEVICES=172.16.101.218:5555 -e CONNECT_TO_GRID=True -e APPIUM_HOST="127.0.0.1" -e APPIUM_PORT=4723 -e SELENIUM_HOST="172.16.101.221" -e SELENIUM_PORT=4444 -p 4723:4723 --name container-appium appium/appium

Also I check the log of container by following command, I cannot see any logs print out by generate_config.sh

docker logs container-appium

But if I do following will works:

docker run -d -t -i -e CONNECT_TO_GRID=True -e APPIUM_HOST="127.0.0.1" -e APPIUM_PORT=4723 -e SELENIUM_HOST="172.16.101.221" -e SELENIUM_PORT=4444 -p 4723:4723 --name container-appium appium/appium
docker exec -it container-appium adb connect 172.16.101.218:5555

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.