Hi Raghava, Those videos are very useful for all learners Please can you share with latest updated frameworks section for AI automation it is very useful in the current market
@@RaghavPal Thanks for the Quick Response We need the latest Selenium with Java and Rest Assured updated classes for real-time experienced Those classes are useful for me but I have Automation step-by-step some classes are outdated Once again Thank you so much for your help
To get the .ipa file from an iPhone: Backup the iPhone using iTunes or Finder (on macOS). Locate the .ipa file in the backup directory: On macOS: ~/Library/Application Support/MobileSync/Backup/ On Windows: C:\Users\\AppData\Roaming\Apple Computer\MobileSync\Backup\ Use third-party tools like iMazing to extract the .ipa file directly from the iPhone Then, set the .ipa file path in app.path in Appium's desired capabilities -
For zoom in / zoom out, should the pointer down / pointer up actions have one for "Left" and one for "Right" since we are using two fingers to zoom? I'm not understanding what the "Left" and "Right" options are used for? I would have thought it was for doing things with 2 fingers but your example doesn't call this out. Just looking for clarification. Thanks!
Janine In Appium, when performing zoom in/out gestures with two fingers, the "Left" and "Right" options refer to the two fingers being used: Left Finger: Represents the first finger (pointer 0). Right Finger: Represents the second finger (pointer 1). Zoom In Example: Pointer Down for both fingers at starting positions. Move both fingers apart. Pointer Up for both fingers. Zoom Out Example: Pointer Down for both fingers at starting positions. Move both fingers closer together. Pointer Up for both fingers. Sample Code Snippet: import io.appium.java_client.TouchAction; import io.appium.java_client.touch.WaitOptions; import io.appium.java_client.touch.offset.PointOption; import org.openqa.selenium.WebDriver; import java.time.Duration; public class ZoomGesture { private WebDriver driver; public ZoomGesture(WebDriver driver) { this.driver = driver; } public void zoomIn() { TouchAction touchAction = new TouchAction(driver); // Coordinates for the two fingers (example values) int leftFingerX = 100; int leftFingerY = 300; int rightFingerX = 300; int rightFingerY = 300; touchAction .press(PointOption.point(leftFingerX, leftFingerY)) .press(PointOption.point(rightFingerX, rightFingerY)) .waitAction(WaitOptions.waitOptions(Duration.ofMillis(1000))) // Wait for a short time .moveTo(PointOption.point(leftFingerX + 50, leftFingerY)) // Move left finger .moveTo(PointOption.point(rightFingerX - 50, rightFingerY)) // Move right finger .release() .perform(); } public void zoomOut() { TouchAction touchAction = new TouchAction(driver); // Coordinates for the two fingers (example values) int leftFingerX = 100; int leftFingerY = 300; int rightFingerX = 300; int rightFingerY = 300; touchAction .press(PointOption.point(leftFingerX, leftFingerY)) .press(PointOption.point(rightFingerX, rightFingerY)) .waitAction(WaitOptions.waitOptions(Duration.ofMillis(1000))) // Wait for a short time .moveTo(PointOption.point(leftFingerX - 50, leftFingerY)) // Move left finger .moveTo(PointOption.point(rightFingerX + 50, rightFingerY)) // Move right finger .release() .perform(); } } This simulates the multi-touch zoom gestures effectively -
What is the use of IDE (Xcode) in Appium? If I want to test iPhone installed apps connected to a Mac OS, where does IDE come into play? And what can be done with the recorded scripts?
In Appium, Xcode serves as the essential IDE (Integrated Development Environment) and toolset for testing iOS applications Xcode is critical for building and deploying iOS apps, and Appium uses it to interact with iOS simulators and devices Appium Recorder generates scripts from your app interactions, which you can use for automation and testing -
For the Recorder part - is there a way to get a recording of the Gestures? For example, when turn on the recorder and then execute "swipe down" it's not recording this action? Is this possible or am I doing something wrong?
Janine When using Appium Inspector for recording actions, it primarily captures basic interactions like taps, clicks, and text inputs. However, complex gestures like swipes or multi-touch actions may not be recorded directly by the Inspector Here are some points to consider: Limitations of Appium Inspector: The recorder may not capture all gesture types, especially those that require a sequence of actions (like swiping) Certain gestures may need to be implemented manually in your test scripts Manual Gesture Implementation: You can manually code gestures using Appium's touch actions if they are not recorded by the Inspector Example: Implementing a Swipe Gesture To manually implement a swipe gesture, you can use the touchPerform method in your test scripts. Here’s how to do it: // Example of performing a swipe down action const { width, height } = await driver.getWindowSize(); const startPoint = height * 0.8; // Start from 80% of screen height const endPoint = height * 0.2; // End at 20% of screen height const anchor = width / 2; // Anchor point in the middle of the screen await driver.touchPerform([ { action: 'press', options: { x: anchor, y: startPoint }, }, { action: 'wait', options: { ms: 100 }, // Optional wait time }, { action: 'moveTo', options: { x: anchor, y: endPoint }, }, { action: 'release', options: {}, }, ]); If the Appium Inspector does not record certain gestures, you can implement them directly in your test scripts using the touchPerform method. Ensure you understand the coordinates and actions required for the gestures you want to implement
Hi Raghav, in desired capabilities json, how to add the app package and app library to open an existing app in our device? And the saved gestures (swipe up or down) is not getting recorded in the recorder but the manual swipe is recorded.
Abishek Here's how you can structure your desired capabilities JSON: Desired Capabilities JSON Example { "platformName": "Android", "platformVersion": "your_platform_version", "deviceName": "your_device_name", "appPackage": "com.example.yourapp", "appActivity": "com.example.yourapp.MainActivity", "automationName": "UiAutomator2" } Key Components: platformName: Specifies the platform (e.g., Android, iOS). platformVersion: The version of the platform on your device. deviceName: The name of your device or emulator. appPackage: The package name of the app you want to open. appActivity: The main activity of the app, which is usually the entry point. automationName: The automation framework to use (e.g., UiAutomator2 for Android). Regarding Gesture Recording: Gesture Recording Issue: If the saved gestures (like swipe up or down) are not being recorded in the Appium recorder, but manual swipes are, this may be due to limitations in the recorder's ability to capture certain touch actions Possible Solutions: Use Touch Actions: Instead of relying on the recorder, you can manually implement swipe actions using Appium's TouchAction class in your test scripts. from appium.webdriver.common.touch_action import TouchAction # Example of a swipe action action = TouchAction(driver) action.press(x=start_x, y=start_y).wait(ms=1000).move_to(x=end_x, y=end_y).release().perform() Check Appium Version: Ensure you are using the latest version of Appium, as improvements and bug fixes are regularly made. Use Alternative Tools: If gesture recording is crucial, consider using other tools or libraries that specialize in UI testing and may provide better gesture recognition -
hi ragav iwas getting ecxpection as session not got created when running appium script when connected with mobile and also i was getting java.lang.IllegalArgumentException how to overcome this problem
Tabita When running Appium scripts, it's not uncommon to encounter issues with session creation. Here are some troubleshooting steps to help you overcome this problem: 1. Check the Appium Server logs: Open the Appium Server logs to see if there are any error messages that can give you a hint about what's going wrong. You can do this by running Appium with the --log-level flag, like this: appium --log-level debug This will output detailed logs that can help you identify the issue. 2. Verify the device connection: Make sure your mobile device is properly connected to your machine and that the USB debugging mode is enabled. You can check the device connection using the adb devices command: adb devices This should list your device's serial number. If you don't see your device listed, try restarting the device or the adb server. 3. Check the Appium capabilities: Review your Appium capabilities to ensure they are correct and match your device's configuration. Here are some common capabilities that might cause issues: * platformName: Ensure it's set to the correct platform (e.g., Android or iOS). * platformVersion: Verify that the version matches your device's OS version. * deviceName: Make sure the device name is correct and matches the one listed in the adb devices output. * app: Ensure the app path is correct and the app is installed on the device. Here's an example of a basic Appium capabilities setup: DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("platformName", "Android"); capabilities.setCapability("platformVersion", "11"); capabilities.setCapability("deviceName", "Samsung Galaxy S22"); capabilities.setCapability("app", "/path/to/your/app.apk"); 4. Handle the java.lang.IllegalArgumentException: This exception is often thrown when there's an issue with the Appium capabilities or the device connection. Check the error message to see if it provides more information about the cause. If you're using Java, you can try catching the exception and printing the error message to get more details: try { // Create the Appium driver AppiumDriver driver = new AppiumDriver(new URL("localhost:4723/wd/hub"), capabilities); } catch (IllegalArgumentException e) { System.err.println("Error creating Appium driver: " + e.getMessage()); } 5. Update Appium and its dependencies: Ensure you're running the latest version of Appium and its dependencies. You can update Appium using npm or by downloading the latest version from the Appium website. 6. Try a different Appium server: If you're using the Appium desktop application, try switching to the Appium command-line server or vice versa. 7. Check for conflicts with other automation tools: If you're running other automation tools (e.g., Selenium) on the same machine, try stopping them and see if the issue persists. By following these steps, you should be able to identify and resolve the issue preventing your Appium script from creating a session -
Sure Maria Here's a step-by-step guide: 1. Start IntelliJ IDEA and open the project you want to record. 2. Go to the "Help" menu in the toolbar at the top. 3. In the drop-down list, select "Start Screen Recording...". This will open a dialog box for screen recording settings. 4. In the dialog box, you can choose the recording options such as the frame rate, whether to capture mouse clicks, whether to highlight the mouse cursor, and the save location for the video file. 5. After setting your preferences, click "Start Recording". 6. Now, all your actions in IntelliJ IDEA will be recorded. You can perform the tasks you want to record. 7. Once you're done, go back to the "Help" menu and select "Stop Screen Recording". Your recording will be saved to the location you specified. 8. You can now review the video file for any necessary edits or share it as needed. Please note that this feature might not be available in all versions of IntelliJ IDEA. If you don't see the option, you might need to update your software or use a third-party screen recording tool. Also, recording might increase the CPU usage and slow down the performance of the software. --
Great tutorial again. Thank you. One helpful code fragment of the recording is "PointerInput Object" Can you say which package or import is necessary for that? Is that provided by the maven repository?
Jochen The PointerInput object is part of the Selenium WebDriver API, specifically the org.openqa.selenium.interactions package. To use PointerInput in your Appium project, you'll need to import the following package: import org.openqa.selenium.interactions.PointerInput; As for Maven, yes, the Selenium WebDriver API is available in the Maven repository. You can add the following dependency to your pom.xml file: org.seleniumhq.selenium selenium-java 4.0.0 Make sure to adjust the version number according to your project's requirements -
Sir i have completed all the videos in this playlist and wanted to know if you have paid or unpaid recorded/live (any) course for mobile testing Appium as I need to quickly learn this skill for my current job. Alternatively if you can suggest any other course or any playlist to learn Appium from scratch to advance.
okay, please follow these steps for setting up Appium mobile test automation on Ubuntu: 1. Install Prerequisites: - Ensure you have the following prerequisites installed on your Ubuntu machine: - Java Development Kit (JDK): You'll need JDK installed. You can check if it's already installed by running `java -version`. If not, install it using `sudo apt install default-jdk`. - Android SDK or Xcode: Depending on the platform you want to test (Android or iOS), install the corresponding SDK. For Android, you can install Android Studio and set up the Android SDK. For iOS, you'll need Xcode installed on a macOS machine. 2. Install Node.js: - Appium is built on Node.js, so you'll need to install it. Run the following commands: ```bash sudo apt update sudo apt install nodejs npm ``` 3. Install Appium Server: - Install Appium globally using npm: ```bash sudo npm install -g appium ``` 4. Start Appium Server: - Open a terminal and start the Appium server: ```bash appium ``` 5. Create a New Appium Project: - Create a new directory for your Appium project: ```bash mkdir my-appium-project cd my-appium-project ``` 6. Initialize a Node.js Project: - Initialize a new Node.js project (if you haven't already): ```bash npm init -y ``` 7. Install Appium Client Libraries: - Depending on your preferred programming language, install the corresponding Appium client library. For example, if you're using JavaScript, install the `webdriverio` package: ```bash npm install webdriverio ``` 8. Write Your First Test Script: - Create a test script (e.g., `my-test.js`) using your preferred text editor. - Import the necessary modules (e.g., `webdriverio`). - Set up your desired capabilities (platform, device, app path, etc.). - Write your test steps (e.g., navigating to a URL, interacting with elements, assertions). 9. Run Your Test: - Execute your test script using Node.js: ```bash node my-test.js ``` 10. Inspect Elements and Locators: - Use Appium Inspector or UIAutomatorViewer (for Android) to inspect elements and find their locators (IDs, XPaths, etc.). Remember that this is a high-level overview, and you might need to adjust some steps based on your specific requirements. Additionally, explore the official Appium documentation and community resources for more detailed information and examples
When my laptop runs the emulator command to get to the virtual screen, it's very slow and doesn't seem to be able to load. Is there any way to make it run faster?
Android emulators can sometimes be sluggish, but there are several ways to improve their performance. Here are some tips to speed up your Android emulator: 1. Enable Quick Boot: Android Studio provides a feature called Quick Boot that saves the emulator state. When you enable this option, the emulator starts up quickly on subsequent boots. To enable Quick Boot: - Click on the emulator's edit button in Android Studio. - Go to "Show Advanced Settings." - Enable the Quick Boot option 2. Increase Heap Size: You can significantly speed up the emulator by adjusting the heap size allocated to it. Follow these steps: - Open the AVD Manager. - Select your device. - Click on the "Details" button. - Look for the heap size (usually set to 24 or 48). - Increase the heap size to a larger value (e.g., 512 or 1024) 3. Use GPU Emulation: The GPU (graphics processing unit) is faster than the CPU. Enabling GPU emulation can improve the emulator's performance. To enable GPU emulation: - Open the AVD Manager. - Edit your AVD. - Enable GPU acceleration in the settings 4. Allocate Sufficient Resources: If you're running the emulator on a virtual machine, ensure that the VM has enough resources (CPU, RAM, and disk space). Virtual machines often have limited resources compared to physical machines, which can impact performance 5. Consider Alternative Emulators: - Genymotion: Genymotion is an alternative emulator that is much faster than the default Android emulator. It's straightforward to install and provides better performance - BlueStacks: BlueStacks is another emulator that you can use for testing. It's not specifically for development, but it's fast and reliable Remember that the emulator experience can vary based on your system specifications. If possible, test your app on an actual device as well to ensure accurate performance.
Hello sir, I am not bale to access browser version of appium pro inspector, though I have started appium --allow-cors still getting pop please start server and URL is correct. but where we need to enter URL?
Neha To access the browser version of Appium Pro Inspector, you can simply navigate to inspector.appiumpro.com/ This will allow you to inspect your mobile apps without installing the App ium Inspector desktop application However, to connect to your Appium server, you need to specify the server URL in the Inspector. Here's how you can do it: Open the Appium Pro Inspector in your browser. Click on the "New Session" button. In the "New Session" dialog, enter the URL of your Appium server in the "Appium Server" field. The format should be localhost:4723 (or the IP and port where your Appium server is running). Click "Start Session" to connect to your Appium server. Make sure that you have started your Appium server with the --allow-cors flag, as you mentioned. This flag is required to enable cross-origin resource sharing (CORS) and allow the Inspector to connect to your Appium server. If you're still facing issues, ensure that your Appium server is running and accessible at the specified URL. You can try checking the Appium server logs for any errors or issues that might be preventing the connection -
Neha From what I've seen, there are several possible reasons why your Appium window might be freezing after syncing with your mobile app One common issue is that Appium might be experiencing internal problems, especially when running tests for an extended period. This can cause the Appium server to freeze, making it unresponsive Another possible reason is related to logging issues within your app. If your app is logging a large amount of data, it can cause Appium to freeze. This is because Appium tries to process the logs, which can lead to performance issues Additionally, full-screen animations or loading screens in your app can also cause Appium to freeze. This is because Appium might struggle to interact with elements on the screen while the animation is running To overcome these issues, you can try the following: Restart the Appium server periodically to prevent internal problems from building up. Disable logging in your app to reduce the amount of data Appium needs to process. Implement a wait mechanism to allow animations or loading screens to complete before interacting with elements on the screen. Here's an example of how you can restart the Appium server using a batch file: "C:/Appium/node.exe" "C:/Appium/node_modules/appium/bin/Appium.js" Then, call this batch file from your execution batch as: start cmd.exe /k LaunchAppium.bat Finally, once the execution is completed, you can kill the node process using: taskkill /F /IM node.exe This should help you overcome the freezing issue with Appium -
Would be helpful to see the automatically generated code pasted into an Eclipse project. I added external libraries java-client, selenium-api, selenium-java, and selenium-remote-driver but am still getting the error message: The type org.openqa.selenium.remote.http.ClientConfig cannot be resolved. It is indirectly referenced from required .class files
The error suggests a mismatch or incompatibility between the Selenium library versions. Here are a few potential solutions: Check library versions: Ensure consistent versions across all Selenium libraries Clean and rebuild the project: Try cleaning and rebuilding your project Check for duplicate or conflicting libraries: Remove any duplicate or conflicting libraries Verify the library imports: Double-check your imports, e.g., import org.openqa.selenium.remote.http.ClientConfig;
Greetings Sir, I hope you are doing well. I'm getting this Appium Inspector error when I start the session with my real Android device. Failed to create session. An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: 'Command 'C:\\Users\\SQA\\SDKTools\\platform-tools\\adb.exe -P 5037 -s RZCW50D238B shell cmd package list packages' exited with code 255'; Command output: Exception occurred while executing 'list': java.lang.SecurityException: Shell does not have permission to access user 150 How can I solve this issue? Thank you!
Atik Let's work through the solution step by step. The error message indicates that Appium Inspector is unable to create a session with your real Android device due to an unknown server-side error. The original error is related to executing an `adb` command, specifically `adb shell cmd package list packages`, which is used to retrieve a list of installed packages on the device. The error code 255 suggests that the command execution failed, and the command output provides more information about the error: `java.lang.SecurityException: Shell does not have permission to access user 150`. Step-by-Step Solution To resolve this issue, follow these steps: 1. Enable USB Debugging and Grant Permissions * Connect your Android device to your computer using a USB cable. * Go to your device's Settings > Developer options > USB debugging and ensure it is enabled. * You may also need to grant permission to the computer by selecting "Allow USB debugging" on your device. 2. Restart the ADB Server * Open a command prompt or terminal window on your computer. * Navigate to the platform-tools directory where `adb.exe` is located (in this case, `C:\\Users\\SQA\\SDKTools\\platform-tools\\`). * Run the command `adb kill-server` to stop the ADB server. * Run the command `adb start-server` to restart the ADB server. 3. Check ADB Permissions * Run the command `adb shell pm list packages` to test if ADB has the necessary permissions to access the device. * If you encounter the same error, try running the command with elevated privileges using `adb root shell pm list packages`. 4. Grant Shell Permission to Access User 150 * Run the command `adb shell pm grant android.permission.INTERACT_ACROSS_USERS android.uid.system` to grant the shell permission to access user 150. * Alternatively, you can try running `adb shell pm grant android.permission.INTERACT_ACROSS_USERS ` replacing `` with the package name of the app you're trying to automate. 5. Restart Appium Inspector * Close and restart Appium Inspector. * Try creating a new session with your Android device again. By following these steps, you should be able to resolve the error and successfully create a session with your Android device using Appium Inspector -
Hi! Raghva when i run the start session it say Failed to create session. An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: 'Command 'C:\\android\\platform-tools\\adb.exe -P 5037 -s 1b34effa install -g C:\\Users\\m1582\\.appium\ ode_modules\\appium-uiautomator2-driver\ ode_modules\\io.appium.settings\\apks\\settings_apk-debug.apk' exited with code 1'; Command output: adb: failed to install C:\Users\m1582\.appium ode_modules\appium-uiautomator2-driver ode_modules\io.appium.settings\apks\settings_apk-debug.apk: Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user] I don't know what wrong with it when i run appium-doctor --android it say appium-doctor --android
Let's break down the error message and troubleshoot the issue step by step. What's happening: 1. Appium is trying to create a new session. 2. To do so, it needs to install the `settings_apk-debug.apk` file on the Android device. 3. The installation command is executed using `adb.exe` (Android Debug Bridge). 4. The command fails with an exit code of 1, indicating an error. 5. The error message is `INSTALL_FAILED_USER_RESTRICTED: Install canceled by user`. Possible Causes: 1. User restrictions: The error message suggests that the installation was canceled by the user. This might be due to a restriction on the device or in the Android settings. 2. ADB issues: There could be a problem with the `adb.exe` command or the Android SDK installation. Troubleshooting Steps: 1. Check Android settings: Go to the Android device's Settings > Security > Unknown sources and ensure that it is enabled. This will allow the installation of apps from unknown sources 2. Disable user restrictions: On some devices, there might be a restriction on installing apps from unknown sources. Check the device's settings to see if there's an option to disable this restriction 3. Verify ADB installation: Run `adb devices` in the command prompt/terminal to check if ADB is working correctly. If not, reinstall the Android SDK or update the platform-tools 4. Check appium-doctor output: You mentioned running `appium-doctor --android`. Please share the output of this command. It might provide more information about the issue 5. Try reinstalling the APK: Delete the `settings_apk-debug.apk` file from the specified location and try running the Appium test again. This might force Appium to reinstall the APK -
Neat and clear. layman can understand. keep it up!
Thanks Aarush
very informative, clear steps for appium setup, Thanks Raghav!
Most welcome Vikram
Best tutorials ever! Thank you!
You're very welcome
Hi Raghava,
Those videos are very useful for all learners
Please can you share with latest updated frameworks section for AI automation it is very useful in the current market
Sure Krishna, what AI tool are you referring to here
@@RaghavPal Thanks for the Quick Response
We need the latest Selenium with Java and Rest Assured updated classes for real-time experienced
Those classes are useful for me but I have Automation step-by-step some classes are outdated
Once again Thank you so much for your help
Sure, I will plan on that Krishna
How can I get the .ipa file of an app that is present in iPhone to be used in app.path in desired capabilities?
To get the .ipa file from an iPhone:
Backup the iPhone using iTunes or Finder (on macOS).
Locate the .ipa file in the backup directory:
On macOS: ~/Library/Application Support/MobileSync/Backup/
On Windows: C:\Users\\AppData\Roaming\Apple Computer\MobileSync\Backup\
Use third-party tools like iMazing to extract the .ipa file directly from the iPhone
Then, set the .ipa file path in app.path in Appium's desired capabilities
-
For zoom in / zoom out, should the pointer down / pointer up actions have one for "Left" and one for "Right" since we are using two fingers to zoom? I'm not understanding what the "Left" and "Right" options are used for? I would have thought it was for doing things with 2 fingers but your example doesn't call this out. Just looking for clarification. Thanks!
Janine
In Appium, when performing zoom in/out gestures with two fingers, the "Left" and "Right" options refer to the two fingers being used:
Left Finger: Represents the first finger (pointer 0).
Right Finger: Represents the second finger (pointer 1).
Zoom In Example:
Pointer Down for both fingers at starting positions.
Move both fingers apart.
Pointer Up for both fingers.
Zoom Out Example:
Pointer Down for both fingers at starting positions.
Move both fingers closer together.
Pointer Up for both fingers.
Sample Code Snippet:
import io.appium.java_client.TouchAction;
import io.appium.java_client.touch.WaitOptions;
import io.appium.java_client.touch.offset.PointOption;
import org.openqa.selenium.WebDriver;
import java.time.Duration;
public class ZoomGesture {
private WebDriver driver;
public ZoomGesture(WebDriver driver) {
this.driver = driver;
}
public void zoomIn() {
TouchAction touchAction = new TouchAction(driver);
// Coordinates for the two fingers (example values)
int leftFingerX = 100;
int leftFingerY = 300;
int rightFingerX = 300;
int rightFingerY = 300;
touchAction
.press(PointOption.point(leftFingerX, leftFingerY))
.press(PointOption.point(rightFingerX, rightFingerY))
.waitAction(WaitOptions.waitOptions(Duration.ofMillis(1000))) // Wait for a short time
.moveTo(PointOption.point(leftFingerX + 50, leftFingerY)) // Move left finger
.moveTo(PointOption.point(rightFingerX - 50, rightFingerY)) // Move right finger
.release()
.perform();
}
public void zoomOut() {
TouchAction touchAction = new TouchAction(driver);
// Coordinates for the two fingers (example values)
int leftFingerX = 100;
int leftFingerY = 300;
int rightFingerX = 300;
int rightFingerY = 300;
touchAction
.press(PointOption.point(leftFingerX, leftFingerY))
.press(PointOption.point(rightFingerX, rightFingerY))
.waitAction(WaitOptions.waitOptions(Duration.ofMillis(1000))) // Wait for a short time
.moveTo(PointOption.point(leftFingerX - 50, leftFingerY)) // Move left finger
.moveTo(PointOption.point(rightFingerX + 50, rightFingerY)) // Move right finger
.release()
.perform();
}
}
This simulates the multi-touch zoom gestures effectively
-
What is the use of IDE (Xcode) in Appium? If I want to test iPhone installed apps connected to a Mac OS, where does IDE come into play? And what can be done with the recorded scripts?
In Appium, Xcode serves as the essential IDE (Integrated Development Environment) and toolset for testing iOS applications
Xcode is critical for building and deploying iOS apps, and Appium uses it to interact with iOS simulators and devices
Appium Recorder generates scripts from your app interactions, which you can use for automation and testing
-
For the Recorder part - is there a way to get a recording of the Gestures? For example, when turn on the recorder and then execute "swipe down" it's not recording this action? Is this possible or am I doing something wrong?
Janine
When using Appium Inspector for recording actions, it primarily captures basic interactions like taps, clicks, and text inputs. However, complex gestures like swipes or multi-touch actions may not be recorded directly by the Inspector
Here are some points to consider:
Limitations of Appium Inspector:
The recorder may not capture all gesture types, especially those that require a sequence of actions (like swiping)
Certain gestures may need to be implemented manually in your test scripts
Manual Gesture Implementation:
You can manually code gestures using Appium's touch actions if they are not recorded by the Inspector
Example: Implementing a Swipe Gesture
To manually implement a swipe gesture, you can use the touchPerform method in your test scripts. Here’s how to do it:
// Example of performing a swipe down action
const { width, height } = await driver.getWindowSize();
const startPoint = height * 0.8; // Start from 80% of screen height
const endPoint = height * 0.2; // End at 20% of screen height
const anchor = width / 2; // Anchor point in the middle of the screen
await driver.touchPerform([
{
action: 'press',
options: { x: anchor, y: startPoint },
},
{
action: 'wait',
options: { ms: 100 }, // Optional wait time
},
{
action: 'moveTo',
options: { x: anchor, y: endPoint },
},
{
action: 'release',
options: {},
},
]);
If the Appium Inspector does not record certain gestures, you can implement them directly in your test scripts using the touchPerform method.
Ensure you understand the coordinates and actions required for the gestures you want to implement
Thank you so much sir , great work
Most welcome
Hi Raghav, in desired capabilities json, how to add the app package and app library to open an existing app in our device?
And the saved gestures (swipe up or down) is not getting recorded in the recorder but the manual swipe is recorded.
Abishek
Here's how you can structure your desired capabilities JSON:
Desired Capabilities JSON Example
{
"platformName": "Android",
"platformVersion": "your_platform_version",
"deviceName": "your_device_name",
"appPackage": "com.example.yourapp",
"appActivity": "com.example.yourapp.MainActivity",
"automationName": "UiAutomator2"
}
Key Components:
platformName: Specifies the platform (e.g., Android, iOS).
platformVersion: The version of the platform on your device.
deviceName: The name of your device or emulator.
appPackage: The package name of the app you want to open.
appActivity: The main activity of the app, which is usually the entry point.
automationName: The automation framework to use (e.g., UiAutomator2 for Android).
Regarding Gesture Recording:
Gesture Recording Issue: If the saved gestures (like swipe up or down) are not being recorded in the Appium recorder, but manual swipes are, this may be due to limitations in the recorder's ability to capture certain touch actions
Possible Solutions:
Use Touch Actions: Instead of relying on the recorder, you can manually implement swipe actions using Appium's TouchAction class in your test scripts.
from appium.webdriver.common.touch_action import TouchAction
# Example of a swipe action
action = TouchAction(driver)
action.press(x=start_x, y=start_y).wait(ms=1000).move_to(x=end_x, y=end_y).release().perform()
Check Appium Version: Ensure you are using the latest version of Appium, as improvements and bug fixes are regularly made.
Use Alternative Tools: If gesture recording is crucial, consider using other tools or libraries that specialize in UI testing and may provide better gesture recognition
-
@@RaghavPal okay Raghav. Thanks for your detailed reply.
Thank you sir !🙏🙏🙏
Most welcome Surya
Do you have any tutorials for Automating Windows desktop java application
Santhosh
I created some random videos like
th-cam.com/video/IqEZB4nVem8/w-d-xo.html
th-cam.com/video/hzzGzZRj9XI/w-d-xo.html
hi ragav iwas getting ecxpection as session not got created when running appium script when connected with mobile and also i was getting java.lang.IllegalArgumentException how to overcome this problem
Tabita
When running Appium scripts, it's not uncommon to encounter issues with session creation. Here are some troubleshooting steps to help you overcome this problem:
1.
Check the Appium Server logs: Open the Appium Server logs to see if there are any error messages that can give you a hint about what's going wrong. You can do this by running Appium with the --log-level flag, like this:
appium --log-level debug
This will output detailed logs that can help you identify the issue.
2.
Verify the device connection: Make sure your mobile device is properly connected to your machine and that the USB debugging mode is enabled. You can check the device connection using the adb devices command:
adb devices
This should list your device's serial number. If you don't see your device listed, try restarting the device or the adb server.
3.
Check the Appium capabilities: Review your Appium capabilities to ensure they are correct and match your device's configuration.
Here are some common capabilities that might cause issues: * platformName: Ensure it's set to the correct platform (e.g., Android or iOS). * platformVersion: Verify that the version matches your device's OS version. * deviceName: Make sure the device name is correct and matches the one listed in the adb devices output. * app: Ensure the app path is correct and the app is installed on the device.
Here's an example of a basic Appium capabilities setup:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "11");
capabilities.setCapability("deviceName", "Samsung Galaxy S22");
capabilities.setCapability("app", "/path/to/your/app.apk");
4.
Handle the java.lang.IllegalArgumentException: This exception is often thrown when there's an issue with the Appium capabilities or the device connection. Check the error message to see if it provides more information about the cause.
If you're using Java, you can try catching the exception and printing the error message to get more details:
try {
// Create the Appium driver
AppiumDriver driver = new AppiumDriver(new URL("localhost:4723/wd/hub"), capabilities);
} catch (IllegalArgumentException e) {
System.err.println("Error creating Appium driver: " + e.getMessage());
}
5.
Update Appium and its dependencies: Ensure you're running the latest version of Appium and its dependencies. You can update Appium using npm or by downloading the latest version from the Appium website.
6.
Try a different Appium server: If you're using the Appium desktop application, try switching to the Appium command-line server or vice versa.
7.
Check for conflicts with other automation tools: If you're running other automation tools (e.g., Selenium) on the same machine, try stopping them and see if the issue persists.
By following these steps, you should be able to identify and resolve the issue preventing your Appium script from creating a session
-
@@RaghavPal thanks very much I will try it
Hi Raghav, thanks for your tutorials, they're so helpful. Could you please demo how to use the recording in IntelliJ?
Sure Maria
Here's a step-by-step guide:
1. Start IntelliJ IDEA and open the project you want to record.
2. Go to the "Help" menu in the toolbar at the top.
3. In the drop-down list, select "Start Screen Recording...". This will open a dialog box for screen recording settings.
4. In the dialog box, you can choose the recording options such as the frame rate, whether to capture mouse clicks, whether to highlight the mouse cursor, and the save location for the video file.
5. After setting your preferences, click "Start Recording".
6. Now, all your actions in IntelliJ IDEA will be recorded. You can perform the tasks you want to record.
7. Once you're done, go back to the "Help" menu and select "Stop Screen Recording". Your recording will be saved to the location you specified.
8. You can now review the video file for any necessary edits or share it as needed.
Please note that this feature might not be available in all versions of IntelliJ IDEA. If you don't see the option, you might need to update your software or use a third-party screen recording tool. Also, recording might increase the CPU usage and slow down the performance of the software.
--
Hi Raghav great work. Are you uploading a demo on using real android device how to automate a test case in the appium inspector ?
Yes Ujjal
@@RaghavPalthanks a lot.
Great tutorial again. Thank you.
One helpful code fragment of the recording is "PointerInput Object"
Can you say which package or import is necessary for that?
Is that provided by the maven repository?
Jochen
The PointerInput object is part of the Selenium WebDriver API, specifically the org.openqa.selenium.interactions package.
To use PointerInput in your Appium project, you'll need to import the following package:
import org.openqa.selenium.interactions.PointerInput;
As for Maven, yes, the Selenium WebDriver API is available in the Maven repository. You can add the following dependency to your pom.xml file:
org.seleniumhq.selenium
selenium-java
4.0.0
Make sure to adjust the version number according to your project's requirements
-
@@RaghavPal thank you for the quick answer. It works perfectly.
Thank you…. How many videos will be uploaded in total in this series?
A few more Helen. I am planning to cover the entire setup part of android and ios with appium
Sir i have completed all the videos in this playlist and wanted to know if you have paid or unpaid recorded/live (any) course for mobile testing Appium as I need to quickly learn this skill for my current job. Alternatively if you can suggest any other course or any playlist to learn Appium from scratch to advance.
Additionally, I loved your teaching style ❤, and impatiently waiting for the upcoming videos
Thanks Harshit, can find all here - automationstepbystep.com
Hi Raghav thank you for this video..can you pls upload tutorials for appium for ubantu?
ok, please let me know what specific do you need for Ubuntu
Mobile automation setup on ubantu for appium
okay, please follow these steps for setting up Appium mobile test automation on Ubuntu:
1. Install Prerequisites:
- Ensure you have the following prerequisites installed on your Ubuntu machine:
- Java Development Kit (JDK): You'll need JDK installed. You can check if it's already installed by running `java -version`. If not, install it using `sudo apt install default-jdk`.
- Android SDK or Xcode: Depending on the platform you want to test (Android or iOS), install the corresponding SDK. For Android, you can install Android Studio and set up the Android SDK. For iOS, you'll need Xcode installed on a macOS machine.
2. Install Node.js:
- Appium is built on Node.js, so you'll need to install it. Run the following commands:
```bash
sudo apt update
sudo apt install nodejs npm
```
3. Install Appium Server:
- Install Appium globally using npm:
```bash
sudo npm install -g appium
```
4. Start Appium Server:
- Open a terminal and start the Appium server:
```bash
appium
```
5. Create a New Appium Project:
- Create a new directory for your Appium project:
```bash
mkdir my-appium-project
cd my-appium-project
```
6. Initialize a Node.js Project:
- Initialize a new Node.js project (if you haven't already):
```bash
npm init -y
```
7. Install Appium Client Libraries:
- Depending on your preferred programming language, install the corresponding Appium client library. For example, if you're using JavaScript, install the `webdriverio` package:
```bash
npm install webdriverio
```
8. Write Your First Test Script:
- Create a test script (e.g., `my-test.js`) using your preferred text editor.
- Import the necessary modules (e.g., `webdriverio`).
- Set up your desired capabilities (platform, device, app path, etc.).
- Write your test steps (e.g., navigating to a URL, interacting with elements, assertions).
9. Run Your Test:
- Execute your test script using Node.js:
```bash
node my-test.js
```
10. Inspect Elements and Locators:
- Use Appium Inspector or UIAutomatorViewer (for Android) to inspect elements and find their locators (IDs, XPaths, etc.).
Remember that this is a high-level overview, and you might need to adjust some steps based on your specific requirements. Additionally, explore the official Appium documentation and community resources for more detailed information and examples
My gosh!! Thank you so much 🥺
Do you have any tutorials for mobile automation test using appium and javascript
not yet
When my laptop runs the emulator command to get to the virtual screen, it's very slow and doesn't seem to be able to load. Is there any way to make it run faster?
Android emulators can sometimes be sluggish, but there are several ways to improve their performance. Here are some tips to speed up your Android emulator:
1. Enable Quick Boot: Android Studio provides a feature called Quick Boot that saves the emulator state. When you enable this option, the emulator starts up quickly on subsequent boots. To enable Quick Boot:
- Click on the emulator's edit button in Android Studio.
- Go to "Show Advanced Settings."
- Enable the Quick Boot option
2. Increase Heap Size: You can significantly speed up the emulator by adjusting the heap size allocated to it. Follow these steps:
- Open the AVD Manager.
- Select your device.
- Click on the "Details" button.
- Look for the heap size (usually set to 24 or 48).
- Increase the heap size to a larger value (e.g., 512 or 1024)
3. Use GPU Emulation: The GPU (graphics processing unit) is faster than the CPU. Enabling GPU emulation can improve the emulator's performance. To enable GPU emulation:
- Open the AVD Manager.
- Edit your AVD.
- Enable GPU acceleration in the settings
4. Allocate Sufficient Resources: If you're running the emulator on a virtual machine, ensure that the VM has enough resources (CPU, RAM, and disk space). Virtual machines often have limited resources compared to physical machines, which can impact performance
5. Consider Alternative Emulators:
- Genymotion: Genymotion is an alternative emulator that is much faster than the default Android emulator. It's straightforward to install and provides better performance
- BlueStacks: BlueStacks is another emulator that you can use for testing. It's not specifically for development, but it's fast and reliable
Remember that the emulator experience can vary based on your system specifications. If possible, test your app on an actual device as well to ensure accurate performance.
Hello sir, I am not bale to access browser version of appium pro inspector, though I have started appium --allow-cors still getting pop please start server and URL is correct. but where we need to enter URL?
Neha
To access the browser version of Appium Pro Inspector, you can simply navigate to inspector.appiumpro.com/
This will allow you to inspect your mobile apps without installing the App ium Inspector desktop application
However, to connect to your Appium server, you need to specify the server URL in the Inspector. Here's how you can do it:
Open the Appium Pro Inspector in your browser.
Click on the "New Session" button.
In the "New Session" dialog, enter the URL of your Appium server in the "Appium Server" field. The format should be localhost:4723 (or the IP and port where your Appium server is running).
Click "Start Session" to connect to your Appium server.
Make sure that you have started your Appium server with the --allow-cors flag, as you mentioned. This flag is required to enable cross-origin resource sharing (CORS) and allow the Inspector to connect to your Appium server.
If you're still facing issues, ensure that your Appium server is running and accessible at the specified URL. You can try checking the Appium server logs for any errors or issues that might be preventing the connection
-
@@RaghavPal Thanks a lot. it is working for me
hello sir, after getting sync mobile app, the window get freeze. do you have any idea why it is getting freeze?
Neha
From what I've seen, there are several possible reasons why your Appium window might be freezing after syncing with your mobile app
One common issue is that Appium might be experiencing internal problems, especially when running tests for an extended period. This can cause the Appium server to freeze, making it unresponsive
Another possible reason is related to logging issues within your app. If your app is logging a large amount of data, it can cause Appium to freeze. This is because Appium tries to process the logs, which can lead to performance issues
Additionally, full-screen animations or loading screens in your app can also cause Appium to freeze. This is because Appium might struggle to interact with elements on the screen while the animation is running
To overcome these issues, you can try the following:
Restart the Appium server periodically to prevent internal problems from building up.
Disable logging in your app to reduce the amount of data Appium needs to process.
Implement a wait mechanism to allow animations or loading screens to complete before interacting with elements on the screen.
Here's an example of how you can restart the Appium server using a batch file:
"C:/Appium/node.exe" "C:/Appium/node_modules/appium/bin/Appium.js"
Then, call this batch file from your execution batch as:
start cmd.exe /k LaunchAppium.bat
Finally, once the execution is completed, you can kill the node process using:
taskkill /F /IM node.exe
This should help you overcome the freezing issue with Appium
-
Please can you upload appium project with javascript
I will plan on this
Hello, when is next video
I am preparing for it should get it by next week
@@RaghavPal I'm very excited and waiting for your next video, you teach very well
Would be helpful to see the automatically generated code pasted into an Eclipse project. I added external libraries java-client, selenium-api, selenium-java, and selenium-remote-driver but am still getting the error message: The type org.openqa.selenium.remote.http.ClientConfig cannot be resolved. It is indirectly referenced from required .class files
That is available in my earlier Appium playlist.. can check here - automationstepbystep.com/
The error suggests a mismatch or incompatibility between the Selenium library versions. Here are a few potential solutions:
Check library versions: Ensure consistent versions across all Selenium libraries
Clean and rebuild the project: Try cleaning and rebuilding your project
Check for duplicate or conflicting libraries: Remove any duplicate or conflicting libraries
Verify the library imports: Double-check your imports, e.g., import org.openqa.selenium.remote.http.ClientConfig;
Greetings Sir, I hope you are doing well.
I'm getting this Appium Inspector error when I start the session with my real Android device.
Failed to create session. An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: 'Command 'C:\\Users\\SQA\\SDKTools\\platform-tools\\adb.exe -P 5037 -s RZCW50D238B shell cmd package list packages' exited with code 255'; Command output: Exception occurred while executing 'list': java.lang.SecurityException: Shell does not have permission to access user 150
How can I solve this issue?
Thank you!
Atik
Let's work through the solution step by step.
The error message indicates that Appium Inspector is unable to create a session with your real Android device due to an unknown server-side error. The original error is related to executing an `adb` command, specifically `adb shell cmd package list packages`, which is used to retrieve a list of installed packages on the device.
The error code 255 suggests that the command execution failed, and the command output provides more information about the error: `java.lang.SecurityException: Shell does not have permission to access user 150`.
Step-by-Step Solution
To resolve this issue, follow these steps:
1. Enable USB Debugging and Grant Permissions
* Connect your Android device to your computer using a USB cable.
* Go to your device's Settings > Developer options > USB debugging and ensure it is enabled.
* You may also need to grant permission to the computer by selecting "Allow USB debugging" on your device.
2. Restart the ADB Server
* Open a command prompt or terminal window on your computer.
* Navigate to the platform-tools directory where `adb.exe` is located (in this case, `C:\\Users\\SQA\\SDKTools\\platform-tools\\`).
* Run the command `adb kill-server` to stop the ADB server.
* Run the command `adb start-server` to restart the ADB server.
3. Check ADB Permissions
* Run the command `adb shell pm list packages` to test if ADB has the necessary permissions to access the device.
* If you encounter the same error, try running the command with elevated privileges using `adb root shell pm list packages`.
4. Grant Shell Permission to Access User 150
* Run the command `adb shell pm grant android.permission.INTERACT_ACROSS_USERS android.uid.system` to grant the shell permission to access user 150.
* Alternatively, you can try running `adb shell pm grant android.permission.INTERACT_ACROSS_USERS ` replacing `` with the package name of the app you're trying to automate.
5. Restart Appium Inspector
* Close and restart Appium Inspector.
* Try creating a new session with your Android device again.
By following these steps, you should be able to resolve the error and successfully create a session with your Android device using Appium Inspector
-
Hi! Raghva
when i run the start session
it say
Failed to create session. An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: 'Command 'C:\\android\\platform-tools\\adb.exe -P 5037 -s 1b34effa install -g C:\\Users\\m1582\\.appium\
ode_modules\\appium-uiautomator2-driver\
ode_modules\\io.appium.settings\\apks\\settings_apk-debug.apk' exited with code 1'; Command output: adb: failed to install C:\Users\m1582\.appium
ode_modules\appium-uiautomator2-driver
ode_modules\io.appium.settings\apks\settings_apk-debug.apk: Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]
I don't know what wrong with it
when i run appium-doctor --android
it say
appium-doctor --android
Let's break down the error message and troubleshoot the issue step by step.
What's happening:
1. Appium is trying to create a new session.
2. To do so, it needs to install the `settings_apk-debug.apk` file on the Android device.
3. The installation command is executed using `adb.exe` (Android Debug Bridge).
4. The command fails with an exit code of 1, indicating an error.
5. The error message is `INSTALL_FAILED_USER_RESTRICTED: Install canceled by user`.
Possible Causes:
1. User restrictions: The error message suggests that the installation was canceled by the user. This might be due to a restriction on the device or in the Android settings.
2. ADB issues: There could be a problem with the `adb.exe` command or the Android SDK installation.
Troubleshooting Steps:
1. Check Android settings: Go to the Android device's Settings > Security > Unknown sources and ensure that it is enabled. This will allow the installation of apps from unknown sources
2. Disable user restrictions: On some devices, there might be a restriction on installing apps from unknown sources. Check the device's settings to see if there's an option to disable this restriction
3. Verify ADB installation: Run `adb devices` in the command prompt/terminal to check if ADB is working correctly. If not, reinstall the Android SDK or update the platform-tools
4. Check appium-doctor output: You mentioned running `appium-doctor --android`. Please share the output of this command. It might provide more information about the issue
5. Try reinstalling the APK: Delete the `settings_apk-debug.apk` file from the specified location and try running the Appium test again. This might force Appium to reinstall the APK
-
@@RaghavPal thank you so much!