6 | Appium Step by Step | How to setup and use Appium Inspector
Вставка
- Опубліковано 10 лип 2024
- Setup and Start Appium Inspector
00:00 Intro
00:47 What we will learn
02:05 Download and install Appium Inspector github.com/appium/appium-insp...
OR
Use web version: inspector.appiumpro.com/
08:45 : Start Appium Inspector
As we have not yet started appium server you will get error message
09:14 Start appium server by running command appium
If you are using the web version of Appium Inspector start appium using command appium --allow-cors
Note the host and port of appium server and provide the same in Appium Inspector
Now again click on Start Session on Appium Inspector
This time you should see the error message for desired capabilities and not for appium server
12:29 Add the Desired Capabilities as per the mobile device or emulator connected to the system
deviceName - can get using command adb devices
platformName - can get using command appium driver list
platformVersion - can get using command adb shell getprop ro.build.version.release
If you have multiple devices connected first get the device id using adb devices then run command
adb -s DEVICE_ID shell getprop ro.build.version.release
app - provide the location of APK file
adb shell getprop ro.build.version.sdk
This command will provide the API level (e.g., “30” for Android 11, “29” for Android 10, etc.)
{
"appium:automationName": "UiAutomator2",
"appium:platformName": "Android",
"appium:platformVersion": "11",
"appium:deviceName": "4b316ae9",
"appium:app": "/Users/raghavpal/Katalon Studio/Android Testing Project/androidapp/APIDemos.apk"
}
20:53 Save and click on Start Session on Appium Inspector
This should start the session
26:39 How to use Emulator with Appium Inspector
Step 1 - Start appium appium --allow-cors
Step 2 - Start Emulator or Connect Physical Device
emulator -list-avds
emulator -avd AvdName
To start AVD in a new state (w/o maintaining the old state)
emulator -avd avd_name -no-snapshot-load
Step 3 - Run command adb devices to see the device id. Can use this for deviceName
Step 4 - Get the Android version of your device or emulator
adb shell getprop ro.build.version.release android version
If you have multiple devices connected first get the device id using adb devices then run command
adb -s DEVICE_ID shell getprop ro.build.version.release
adb shell getprop ro.build.version.sdk api level
Step 5 - Check the appium drivers available appium driver list
Step 6 - Get location for a demo APK file (for android)
Step 7 - Add all details in the Desired Capabilities of Appium Inspector
{
"appium:automationName": "UiAutomator2",
"appium:platformName": "Android",
"appium:platformVersion": "14",
"appium:deviceName": "emulator-5554",
"appium:app": "/Users/raghavpal/Katalon Studio/Android Testing Project/androidapp/APIDemos.apk"
}
Step 8 - Start Session
35:10 How to use Browserstack Devices with Appium Inspector
Use Appium Inspector desktop version
Step 1 - On Appium Inspector top menu click Select Cloud Providers and select Browserstack
Step 2 - Create account on Browserstack and get your username and accesskey
Step 3 - On Browserstack upload your application or use the demo application
Step 4 - If needed can use capabilities generator www.browserstack.com/app-auto...
Step 5 - Add the browserstack username, accesskey and desired capabilities in Appium Inspector
{
"appium:automationName": "UiAutomator2",
"platformName": "Android",
"appium:platformVersion": "9.0",
"appium:deviceName": "Google Pixel 3",
"appium:app": "bs://c700ce60cf13ae8ed97705a55b8e022f13c5827c"
}
Ref: appium.github.io/appium-inspe...
Browserstack Capabilities Generator - www.browserstack.com/app-auto...
SauceLabs Capabilities Generator - saucelabs.com/products/platfo...
LambdaTest Capabilities Generator - www.lambdatest.com/capabiliti...
47:15 Next Steps
Document - docs.google.com/document/d/e/...
All Free Tutorials 🟢 AutomationStepByStep.com/
▬▬▬▬▬▬▬
Share with all who may need this
If my work has helped you, consider helping any animal near you, in any way you can
Never Stop Learning
Raghav Pal
▬▬▬
Thanks for the super clear video. Now I start to believe I can nail it and start to automate
Glad it helped Kateryna
thank you mr.ragav, i opened the calculator app after trying for 1 month.
So happy to know this Satheesh
Thank you so much sir , great work
Most welcome
You are the best, thank you so much, great videos as always
Glad you like them Kevin
@@RaghavPal hi, could you do one on how to configure test reporting from appium with allure on the ci?
Making a lecture on this may take time.. for now here are the steps to configure test reporting with Appium, TestNG, and Allure for a Maven project. Here's a step-by-step guide:
1. Setting up the Project:
- Create a new Maven project.
- Configure the `pom.xml` file with dependencies for Appium, TestNG, and Allure Reports.
2. Appium Configuration:
- Implement a configuration class that initializes the `AppiumDriver` instance based on desired capabilities.
- Use desired capabilities to specify device information, platform details, app path, and other configurations.
- Take runtime environment variables (OS, execution place, locale, thread count) to dynamically create the driver for local or cloud-based devices.
3. TestNG Test Cases:
- Create test classes with annotated methods representing different test scenarios.
- Leverage the Page Object Model (POM) and create an abstract class at the screen level to handle common functionality between Android and iOS applications.
- Use a business logic layer to handle test logic (data entry, result validation).
- Invoke methods from the screen abstract class based on the OS and driver.
4. Test Data and Configuration:
- Store test data and environment configurations in JSON files for better organization.
- Implement a JSON reader to fetch data from files.
5. TestNG XML Configuration:
- Create a TestNG XML configuration file to control the test runner and manage test suites.
- Define test suites, specify test classes, and set test parameters in the XML file.
- Use runtime environment variables to select the operating system (Android or iOS) for testing.
6. Test Context for Data Passing:
- Use a test context object to hold shared data or objects across different test cases.
- Pass information between test methods by storing and retrieving data from the test context.
7. Maven Build and Execution:
- Run the Maven build command to compile the code and resolve dependencies.
- Use `mvn test` to execute tests, triggering the TestNG runner defined in the XML configuration.
8. Allure Reports Integration:
- Integrate Allure Reports into the framework.
- Annotate test methods with Allure annotations like `@Step`, `@Description`, and `@Attachment` to enhance the report with contextual information and artifacts.
Remember to adapt these steps to your specific Maven project structure
--
thank you, you are best
Most welcome Kiếm
Hello Mr. I want to test a windows application .exe file. What capabilities should i invoke? what do you suggest?
Melih
Let's break down the steps to set up Appium for testing a Windows application (.exe file) using Appium 2.x.
Step 1: Choose the correct driver
For testing a Windows application, you'll need to use the WinAppDriver. This driver is specifically designed for automating Windows desktop applications.
Step 2: Set up the capabilities
To set up the capabilities, you'll need to create a `DesiredCapabilities` object and add the required capabilities. Here are the essential capabilities you'll need:
* `platformName`: Set to `"Windows"` to indicate that you're testing a Windows application.
* `platformVersion`: Set to the version of Windows you're testing on (e.g., `"10"` for Windows 10).
* `deviceName`: Set to `"WindowsPC"` to indicate that you're testing on a Windows PC.
* `app`: Set to the path of your `.exe` file (e.g., `"C:\\Path\\To\\Your\\App.exe"`).
* `automationName`: Set to `"Windows"` to specify the automation technology used by WinAppDriver.
Here's an example of how your capabilities might look:
```java
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "Windows");
capabilities.setCapability("platformVersion", "10");
capabilities.setCapability("deviceName", "WindowsPC");
capabilities.setCapability("app", "C:\\Path\\To\\Your\\App.exe");
capabilities.setCapability("automationName", "Windows");
```
Additional suggestions
* `ms:waitForLaunch`: Set to `true` to wait for the application to launch before starting the test.
* `ms:waitForIdle`: Set to `true` to wait for the application to become idle before starting the test.
Here's the updated example:
```java
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "Windows");
capabilities.setCapability("platformVersion", "10");
capabilities.setCapability("deviceName", "WindowsPC");
capabilities.setCapability("app", "C:\\Path\\To\\Your\\App.exe");
capabilities.setCapability("automationName", "Windows");
capabilities.setCapability("ms:waitForLaunch", true);
capabilities.setCapability("ms:waitForIdle", true);
```
Step 3: Create an Appium driver instance
Create an instance of the Appium driver, passing in the capabilities object:
```java
AppiumDriver driver = new AppiumDriver
-
Hello!
I have installed and set up everything, using your previous videos. Now, when I have started my Appium server and trying to start session on Appium inspector, I’m getting that error: “Invalid or unsupported WebDriver capabilities found ("undefined"). Ensure to only use valid W3C WebDriver capabilities”
I’m using MacOS, and I have installed all the drivers in Appium drivers, but it doesn’t help. May you give any advices, where could be the problem?
So issue is solved after I have added all needed capabilities
The error message you're encountering-"Invalid or unsupported WebDriver capabilities found"-usually occurs when the desired capabilities provided to Appium Inspector are not in the expected format. Let's troubleshoot this:
1. Check Desired Capabilities Format:
- Ensure that you're using the correct format for desired capabilities. They should be specified as a JSON object with key-value pairs.
- For example, if you're testing an Android app, the desired capabilities might look like this:
```json
{
"platformName": "Android",
"appPackage": "com.xxx.xyz",
"appActivity": "com.xxx.xyz.xyzActivity"
}
```
- Make sure you're not missing any required capabilities.
2. Vendor-Specific Capabilities:
- If you're running tests on a remote vendor (e.g., Sauce Labs or BrowserStack), put the capabilities into vendor-specific sections (e.g., "sauce:options" or "bstack:options").
- Appium Inspector enforces strict compatibility with the W3C WebDriver specification, so ensure your capabilities adhere to it⁴.
3. Automatically Add Necessary Appium Vendor Prefixes:
- When starting Appium Inspector, make sure to check the option to "Automatically add necessary Appium vendor prefixes on start". This ensures that the capabilities are correctly formatted².
4. Remote Path Configuration:
- If you're starting the Appium Inspector without specifying the remote path, it might pick up the default path ("/"). Define the remote path as "/wd/hub" when starting the server³.
5. Appium Version Compatibility:
- Verify that your Appium version is compatible with the desired capabilities format. Some changes might occur between different Appium versions.
--
Hello, Raghav! Thank you for your excellent work!!!
I encountered the following problem: the session is broken with error code 255 in Appium Desktop, and in the command line, it shows post -500. Appium settings as well as the application are installed on the phone. USB debugging and data transfer are enabled. Have you encountered this problem? The environment is Windows 10, Android 14 Samsung, Appium 2.5.4, Appium-Doctor 1.16.2. Environment variables have also been set. If you have encountered this problem, please advise. I have been searching for a solution for a long time, and everyone writes that you need to enable USB debugging or configure the variables.
Rumpel
It sounds like you are facing a connection issue with Appium when trying to run tests on your Android device. The error code 255 or post -500 can sometimes be tricky to troubleshoot, but here are a few suggestions that might help you resolve this problem:
1. Check Appium Logs:
- Look into the Appium logs to see if there are more detailed error messages or clues about what might be causing the issue. This can provide insights into what specifically went wrong during the session setup.
2. Update Appium and Dependencies:
- Ensure that you are using the latest version of Appium and all its dependencies. Sometimes, compatibility issues or bugs in older versions can cause unexpected errors. Consider updating to the latest stable release of Appium.
3. Restart Appium Server:
- Try restarting the Appium server, as well as your computer and Android device. This simple step can sometimes resolve connectivity issues by resetting the environment.
4. Check USB Connection:
- Double-check the USB connection between your computer and Android device. Use a different USB cable or port to rule out any physical connection issues.
5. Verify Developer Options:
- Confirm that USB debugging mode is enabled on your Android device. Additionally, check other developer options related to ADB connections and USB configurations to ensure everything is set up properly.
6. Verify Appium Server Configuration:
- Review your Appium server settings and capabilities to make sure they are configured correctly for the Android device and application you are testing. Ensure that the desired capabilities match the device settings and application details.
7. Permissions and Firewall Settings:
- Check if any security software or firewall settings on your computer might be blocking the connection between Appium and the Android device. Temporarily disable these security measures for testing purposes.
--
@@RaghavPal Thank you, Raghav! I will try to find the problem!
I am unable to open UIAutomateViewer on my Mac. Could you please explain why this issue is occurring?
Mouni
Are you trying to use UIAutomatorViewer or Appium Inspector. Please check and let me know with specific error and message you are facing
adb command is not running in my machine. how to setup that
Prateek
If you're encountering issues with the `adb` command, here are some steps you can take to troubleshoot and set it up correctly:
1. Check if ADB is Installed:
First, verify that ADB is installed on your system. You can do this by running the following command in your terminal:
```
~/Library/Android/sdk/platform-tools/adb
```
If it prints output, ADB is installed. If not, proceed to the next steps.
2. Add ADB to Your System Path:
- Open your terminal and edit your shell profile file (usually `~/.bash_profile` or `~/.zprofile` if you're using Zsh).
- Add the following lines to the file:
```bash
export PATH=~/Library/Android/sdk/tools:$PATH
export PATH=~/Library/Android/sdk/platform-tools:$PATH
```
- Save the file and either restart your terminal or run:
```bash
source ~/.bash_profile
```
(or `source ~/.zprofile` if using Zsh).
3. Restart ADB:
- If ADB was already running, kill it using:
```bash
adb kill-server
```
- Then start it again:
```bash
adb start-server
```
4. Check Android Studio and SDK Manager:
- Launch Android Studio.
- Go to Tools > Android > SDK Manager.
- Make sure Android SDK Platform-Tools is installed.
5. Enable USB Debugging on Your Phone:
- On your Android device, go to Settings > About phone.
- Tap on Build number multiple times until you see a message saying you're a developer.
- Go back to Settings, and now you'll find a Developer options menu.
- Enable USB debugging.
6. Restart Your Terminal:
Sometimes changes to the PATH take effect only after restarting your terminal.
Remember to replace `` with your actual username in the paths above
--
Seems topics from appium inspector are not available in doc @Raghav
Its there.. check Setup and Start Appium Inspector
@@RaghavPal Sorry Raghav. I was searching on part 3,4,5 doc... Thanks for your quick reply
is this work for flutter app and will this driver work for flutter too?
and please create the series in Javascript
I will plan Subrat
Can you please make videos on automating desktop applications using appium in windows/Mac
Sure I will plan on this Pravalika
hi ragav , i'm getting this Failed to create session. An unknown server-side error occurred while processing the command. Original error: Could not find a connected Android device in 20000ms when i try to run on my real device , thank you for ur amezing vdos
Nazra
is your device setup properly. After connecting your real device, if you open command line and run command adb devices, do you get your device id.
Have you updated the desired capabilites in Appium Inspector accordingly.
After this Check the following:
1. Device Connection:
- First, ensure that your real Android device is properly connected to your computer via USB.
- Check if the device appears in the list of connected devices using the `adb devices` command in your terminal. If it doesn't, make sure USB debugging is enabled on your device.
2. Appium Configuration:
- Verify that your Appium configuration is correct. Specifically, check the following parameters in your desired capabilities:
- `deviceName`: Make sure it matches the name of your connected Android device.
- `platformName`: Set it to `"android"`.
- `appPackage` and `appActivity`: These should correspond to the package name and main activity of your app.
- `noReset`: Set it to `true` if you want to reuse the app state between sessions.
3. Server Path:
- Appium 2.0 uses a different default server path. Ensure that you're using the correct path in your configuration.
- If you're migrating from Appium Desktop (which works with Appium 1.x), update the remote server path from `/wd/hub` to just `/` in Appium Inspector
4. Uninstall UIAutomator:
- Some users have reported success by uninstalling the UIAutomator apps from their devices.
- Go to your device's Settings > Apps, search for "uiautomator," and uninstall any related apps.
- This step can help resolve issues when the session crashes multiple times
5. Check Server Address:
- Verify that the server address in your code matches the actual Appium server name.
- Sometimes incorrect server addresses can lead to session creation failures.
6. Update Appium:
- Ensure that you're using a compatible version of Appium. Consider updating to the latest stable release if you haven't already.
Remember to double-check your configuration, verify the device connection, and follow the steps above. Hopefully, this will help you create a successful session with your real Android device
--
hello sir This series is python with appium or java with appium
Sai
till now all these sessions are common and deal with the basic setup of appium, android, ios env, appium inspector etc. Not yet started with appium client languages
Hello Raghav, in the next videos of this series, which language will you use for appium?
Bình
as of now some videos will be dedicated to the setup as we have iOS setup pending. I plan to make this series to enable beginners get started with the complete setup which mostly is the tricky part in Appium and then decide on a language and progress further as per the project needs.
@@RaghavPal create the series in JS
Can you pleas upload the 7th video
done