Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to start appium for context.startInstrumentation #498

Open
herenxue opened this issue Jan 8, 2023 · 10 comments
Open

How to start appium for context.startInstrumentation #498

herenxue opened this issue Jan 8, 2023 · 10 comments

Comments

@herenxue
Copy link

herenxue commented Jan 8, 2023

for adb shell is am instrument -w io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner
I wanto to start in my android application,how to start use startInstrumentation method, thanks

@KazuCocoa
Copy link
Member

Do you mean you'd like to start your test app with adb shell is am instrument -w your.test.app/androidx.test.runner.AndroidJUnitRunner instead of starting your test app process by Appium?

@herenxue
Copy link
Author

herenxue commented Jan 9, 2023

您的意思是您想启动测试应用程序而不是通过 Appium 启动测试应用程序过程吗?adb shell is am instrument -w your.test.app/androidx.test.runner.AndroidJUnitRunner

Yes, I want to in my test App to start Appium. Achieve the “adb shell is am instrument -w your.test.app/androidx.test.runner.AndroidJUnitRunner” effect 。I find a way is in my app use context.startInstrumentation() method, but I don't know it right or not,. if I want to mplement such functionality in my app, How should I do? thanks.

@KazuCocoa
Copy link
Member

Then,

  1. start an appium session without app and packageName capabilities
    • Then, an appium session starts without launching any apps
  2. Calls mobile:shell command as am instrument -w your.test.app/androidx.test.runner.AndroidJUnitRunner

These steps may achieve it

@herenxue
Copy link
Author

I know you means, but my test app in mobile phone has not permission to exec shell commods. I should user Intent to start or startInstrumentation or others in my test app?

@herenxue
Copy link
Author

I want implement the function is in my test app, to start the test AppiumUiAutomator2Server(In terminal is input adb shell is am instrument -w your.test.app/androidx.test.runner.AndroidJUnitRunner).

@herenxue
Copy link
Author

You cant imagine if I install the two appium test apk.But in normal I must input adb shell is am instrument -w your.test.app/androidx.test.runner.AndroidJUnitRunner in terminal.But I want my test app auto start the appium.It means I didn't to input adb shell commond.Just launch my test app,and then across my test app to start appium(It is equivalent to we input adb shell commond in terminal)?

@mykola-mokhnach
Copy link
Contributor

I know you means, but my test app in mobile phone has not permission to exec shell commods. I should user Intent to start or startInstrumentation or others in my test app?

It is impossible because of standard Android security restrictions. instrumentation process could only be executed by a shell or a root user. The shell user is only available externally via adb and the latter is only available in rooted devices.

@herenxue
Copy link
Author

So if I want in my app to start AppiumUiAutomator2Server is no way?

@KazuCocoa
Copy link
Member

I see... then perhaps no

@herenxue
Copy link
Author

Might you consider providing a way that the other app can start the server instead of input adb shell is am instrument -w io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner ? It's can more convenient for use appium test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants