Appium Automation Framework from scratch | Java | Maven | TestNG
HTML-код
- Опубликовано: 1 авг 2024
- FREE Courses - automationstepbystep.com/
Intro - 0:00
Step 1 : Open Eclipse 3:40
Step 2 : Install TestNG in eclipse • How To Add TestNG Plug...
• Selenium Framework for...
Step 3 : Create a new maven project 5:20
Step 4 : Add required lib/dependencies 7:31
Appium java client 8:40
Selenium java 9:50
TestNG 10:20
Step 5 : Save - Clean - Build project 12:00
Step 6 : Create 2 folders under src/test/java 12:20
tests
pages
Step 7 : User src/test/resources create a folder 14:00
apps
will keep application files (.apk, .ipa, .app)
Step 8 : Inside tests folder create a class - BaseClass 15:15
Step 9 : Create setup & teardown functions 16:00
Annotate with testng annotations
Step 10 : Add code for desired capabilities 18:25
Step 11 : Attach mobile device (or make emulator ready) 25:50
adb devices
get id and platform ver and add in desired capabilities
Step 12 : Start appium server 29:00
Step 13 : Run & test 35:55
Step 14 : Add test class and extend BaseClass 39:05
Appium Automation Framework from scratch
Eclipse Java Maven TestNG
Step by Step
Can follow on Windows & Mac
What we will do:
1. Create a java maven project in eclipse
2. Add required libraries
3. Create classes and functions
4. Add desired capabilities
5. Setup mobile device and appium
6. Create tests for mobile test automation
7. Run and test
Prerequisites:
1. Java JDK - • Java
2. Appium is installed
3. Android sdk is setup (for testing on android )
4. Xcode is setup (for testing on iOS)
5. Mobile device is ready for automation • Appium Step by Step fo...
6. Eclipse is installed
Useful Links
Element locators
appium.io/docs/en/commands/ele...
Appium API Documentation
appium.io/docs/en/about-appium...
#AppiumBeginnerTutorials
Udemy - www.udemy.com/user/raghav-pal-3/
Training by Raghav at your venue - raghav.qna@gmail.com
Training schedule - automationstepbystep.com/trai...
----------- UI TESTING -----------
Selenium Beginners - bit.ly/2MGRS8K
Selenium Java Framework from Scratch - bit.ly/2N9xvR6
Selenium Python - bit.ly/2oyMp5x
Selenium Tips - bit.ly/2owxc50
Selenium Builder - bit.ly/2MKNtlq
Katalon Studio - bit.ly/2wARFdi
Robot Framework with RIDE- bit.ly/2Px6Ue9
Robot Framework with Eclipse - bit.ly/2N8DZxb
----------- API TESTING -----------
Web Services (API) - bit.ly/2MGafL7
SoapUI - bit.ly/2MGahmd
Postman - bit.ly/2wz8LrW
General - bit.ly/2PYdwmV
Katalon Studio API Testing - bit.ly/2BwuCTN
----------- MOBILE TESTING -----------
Appium - bit.ly/2ZHFSGX
Mobile Playlist - bit.ly/2PxpeUv
----------- CI | CD | DEVOPS -----------
Jenkins Beginner - bit.ly/2MIn8EC
Jenkins Tips & Trick - bit.ly/2LRt6xC
Docker - bit.ly/2MInnzx
----------- VERSION CONTROL SYSTEM -----------
Git & GitHub - bit.ly/2Q1pagY
----------- PERFORMANCE TESTING -----------
JMeter Beginner - bit.ly/2oBbtIU
JMeter Intermediate - bit.ly/2oziNVB
JMeter Advanced - bit.ly/2Q22Y6a
JMeter Tips & Tricks - bit.ly/2NOfWD2
Performance Testing - bit.ly/2wEXbLS
----------- PROGRAMMING -----------
Java Beginners - bit.ly/2PVUcXs
Java Tips & Tricks - bit.ly/2CdcDnJ
GROOVY - bit.ly/2FvWV5C
----------- IDE -----------
Visual Studio Code - bit.ly/2V15yvt
----------- MAVEN -----------
Maven - bit.ly/2NJdDRS
----------- OTHERS -----------
Redis- bit.ly/2N9jyCG
Misc - bit.ly/2Q2q5xQ
Tools & Tips - bit.ly/2oBfwoR
QnA Friday- bit.ly/2NgwGpw
Sunday Special - bit.ly/2wB23BO
Ask Raghav - bit.ly/2CoJGWf
Interviews - bit.ly/2NIPPxk
All Playlists - bit.ly/2LSiezA
Website - automationstepbystep.com/
Udemy Courses - www.udemy.com/user/raghav-pal-3/
RUclips - / automationstepbystep
You can support my mission for education by sharing this knowledge and helping as many people as you can
Never Stop Learning
Raghav
I feel myself lucky because of finding your channel, when I search on youtube. I m planning to watch all your videos. Thank you for your clear explanation and your effort.
Most welcome
Thank you! Your tutorials are the best of the best! I had no prior experience and i was able to install and run scrips from scratch in three days following your tutorial , Your install instructions has 100% accuracy. Here now trying some scripts.
You're welcome. Best wishes
@@RaghavPalhey raghav can we test the font size and its family for instagram app? Using appium inspector?
the best, simple, very straight forward, easy to understand tutorial! Thank you Sir!
Most welcome Seliti
Thank you Raghav .Your approach to teaching is systematic ,clear and awesome .I have learnt slenium using your videos
So glad to hear that Trellis
This is the best video i have seen till date. Very useful. The steps are very clear and explained so well. Cannot thank you much.
You are most welcome Hansita. humbled
Thanks Raghav for explaining it so well in super easy steps..Kudos!
You're welcome Surendra
This is pretty awesome video. Excellent work Raghav on explaining details- great work. Thank you !!!!
most welcome Chandra
Amazing explanation, made the concept so easy and clear - framework from scratch. Thanks a lot for making this video. Keep making the videos and help passionate learners to reach their goals. Waiting for the Android and IOS framework videos.
Glad it helped Lakshmi
The best tutorial on framework i have gone through..
Thank raghav. keep going on
Happy to see your message Vinay. humbled
It couldn't be any easier... Loved it.. Thanks Raghav ::)
Glad to hear that Tanisha
Excellent Tutorial Raghav - Great Work !! Thank you
You're welcome Mohan
I just would like to say thank you for these videos, you are helping me so much.
You are so welcome Emanuel
Raghav you have explained it very well. Thanks for the good work.
You're welcome Rahman
For who is stuck after run with test one, you should update a little bit because we are finding element of selenium webdriver instead android app:
AppiumDriver driver;
=> Update to: WebDriver driver;
driver = new AppiumDriver(url, caps);
=> Update to: driver = new RemoteWebDriver(url, caps);
Thanks for this information Tiến
Thanks Bro! You saved my day
Thanks much for the info !!
Thanks Tien... one more way it worked for me was use of direct xpath instead of name locator... "findElement(By.xpath("//input[@name='q']"))" it ran successfully..
What if we want to run with ?
Because with iOS accessibility id RemoteWebDriver is not working.
Very very good tutorial. Awesome work! Thank you :)
You're welcome Lucas
superb Explanation and get knowledge in Appium, Keep going on thanks for your effort
You're welcome Samson
Thank you Raghav pal, your explanation gives us confidence In our selves to perform exceptionally well at interview thanks a lot Raghav
You're welcome Sai
Excelente trabalho. Obrigado pela dedicação do seu tempo.
Muito bem-vindo
Your explanation looks like god-level bro. Seriously !. Before your tutorial I don't know how to use appium. Now I hope I'll get a good job in QA. Thanks for your precious video bro. Thank you.
So happy and humbled to see your message Giridhar
Amazing tutorial very well explained!!! Thank you so much for the video!!
Most welcome Jack
very useful videos and thank you for all your efforts, i have problem finding TestNG part one. thanks again
Hi Mahmood, you can check the complete playlist here - automationstepbystep.com/
wow, you create Appium step by step too, thank you Raghav
Hi Novanto, sure, you can find all courses here - automationstepbystep.com/
Sir your explanation is very clear as well as while presenting your screen is very clear .Thanks Sir.
You're most welcome Smita
Very very cool and interesting .Thank you very much!
You're welcome jiejun
great description, I have solved my problem...
Happy to know Amandeep
Thank you so much for this amazing tutorial ! very well explained in vedio and fully all things covered for beginners. Please, make vedio on diff types of exceptions / errors / challenges are getting while creating framework as well more suggestions on Appium automation framework.
Hi Bhushan, sure, I will do
this is fantastic !!
Thanks for watching
Amazing, amazing, amazing.. I am short of words
Thanks a lot Khhyati.. humbled
Great explanation nice and clean. Thanks
You're welcome Athar
Very good tutorial on Appium, nice explained
Glad you liked it
Thank you Raghav ! I am a Subscriber and will request for more Videos on Appium Frame work specially on Pages of POM.
I will do Himadri
Thank you Raghav ,
Really nice video , I always waiting for your next video .
You're welcome Kunal. Thanks for watching
@@RaghavPal i want to learn how to provide data from Csv file .
I will try to add a video, meanwhile you can check this video that will help you
ruclips.net/video/CV3SOorFydE/видео.html
ruclips.net/video/02ANy2pu_ZA/видео.html
@@RaghavPal :)
Thank you, so much. God bless you!!!
You are so welcome!
easy to understand..the way u explains
Thanks Raushan
Awesome Tutorial....................
Thanks for watching Mahesh
Very good. Thanks for sharing.
You're welcome Fazle
Very nicely explained. Thanks
You are welcome
Thank you Raghav....you help me a lot..
So nice of you Zulfiqar
Thank you it was very easy and clear
Most welcome Zarif
Thank you very much!!!!!!!! You are the best :)
You're welcome!
Hi Raghav, I have been searching alot for some good tutorials on Automation using Appium and Maven and I finally came across your videos - Very well laid out and explained. Thank you so much for helping us get a good grasp of the concepts.
I have a few doubts:
1. I used pom to define my dependencies- appium java client, selenium and tetng jars and built the maven application. Now when trying to go to AppiumDriver or AndroidDriver class, I get an error mentioning that the JAR file has no source attachment I couldnt find the path too to mention. How do I go about resolving that as I am interested in exploring the classes in some jar files.
2. When setting the below capability (basically instantiating the ChromeDriver), I am getting the below errror-
No Chromedriver found that can automate Chrome '58.0.3029'
Glad to know it helped Divya.
1. You can provide the location of your jar. Check here - stackoverflow.com/questions/15180411/attach-the-source-in-eclipse-of-a-jar
2. You will need to get chromedrive exe ver as per the ver of chrome browser on your system
When i created a maven project getting error in pom.xml file
when clicked on that error shown like this not able to check this
Multiple annotations found at this line:
- CoreException: Could not get the value for parameter compilerId for plugin execution default-compile: PluginResolutionException: Plugin
org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved: Failed to collect dependencies at
org.apache.maven.plugins:maven-compiler-plugin:jar:3.1 -> org.apache.maven:maven-toolchain:jar:1.0 -> org.apache.maven:maven-core:jar:2.0.6 ->
org.apache.maven:maven-project:jar:2.0.6 -> org.apache.maven:maven-artifact-manager:jar:2.0.6: ArtifactDescriptorException: Failed to read artifact descriptor
for org.apache.maven:maven-artifact-manager:jar:2.0.6: ArtifactResolutionException: Failure to transfer org.apache.maven:maven-artifact-manager:pom:2.0.6
from repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed
or updates are forced. Original error: Could not transfer artifact org.apache.maven:maven-artifact-manager:pom:2.0.6 from/to central (
repo.maven.apache.org/maven2): The operation was cancelled.
- CoreException: Could not get the value for parameter compilerId for plugin execution default-testCompile: PluginResolutionException: Plugin
org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved: The following artifacts could not be resolved:
org.apache.maven:maven-plugin-api:jar:2.0.9, org.apache.maven:maven-artifact:jar:2.0.9, org.codehaus.plexus:plexus-utils:jar:1.5.1, org.apache.maven:maven-
core:jar:2.0.9, org.apache.maven:maven-settings:jar:2.0.9, org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.9, org.apache.maven:maven-
profile:jar:2.0.9, org.apache.maven:maven-model:jar:2.0.9, org.apache.maven:maven-repository-metadata:jar:2.0.9, org.apache.maven:maven-error-
diagnostics:jar:2.0.9, org.apache.maven:maven-project:jar:2.0.9, org.apache.maven:maven-plugin-registry:jar:2.0.9, org.apache.maven:maven-plugin-
descriptor:jar:2.0.9, org.apache.maven:maven-artifact-manager:jar:2.0.9, org.apache.maven:maven-monitor:jar:2.0.9, org.apache.maven:maven-toolchain:jar:1.0,
org.apache.maven.shared:maven-shared-utils:jar:0.1, org.apache.maven.shared:maven-shared-incremental:jar:1.1, org.codehaus.plexus:plexus-compiler-
api:jar:2.2, org.codehaus.plexus:plexus-compiler-manager:jar:2.2, org.codehaus.plexus:plexus-compiler-javac:jar:2.2, org.codehaus.plexus:plexus-container-
default:jar:1.5.5: Failure to transfer org.apache.maven:maven-plugin-api:jar:2.0.9 from repo.maven.apache.org/maven2 was cached in the local repository,
resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact
org.apache.maven:maven-plugin-api:jar:2.0.9 from/to central (repo.maven.apache.org/maven2): The operation was cancelled.
Is there any solution for this
Eclipse Version - 2020-06 (4.16.0)
Hi Lakshmi, try to update maven project
Rt click > Maven > Update > Force Update
stackoverflow.com/questions/39926064/coreexception-could-not-get-the-value-for-parameter-compilerid-for-plugin-execu/41416449
Excellent :)
Thanks Nataraj
Awesome Tutorial !!!
Thanks for watching
very good knowledge and tutorials
Glad you think so!
Thanks raghav. you are doing great work . can you continue doing framework on appium and testproject.
Thanks Pavan. Sure will continue.
Thank you very good tutorial !!!!!!!!!
You are welcome!
very nicely explained
Thank you so much Harsh
Great work
Thanks for watching Bhavya
Hi, I've been following along in Java and the tests seem to run and pass, however, when running two tests, it doesn't even wait for the browser to load the results of the first search before moving on to the second test.
I have "cap.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 60);" in my code, but is there a different or specific way of waiting between tests? Not sure what else I can try and new to coding so unsure where I would put any wait commands.
Any help would be appreciated.
Hi, ideally, implicit wait at global level and page load timeouts should be sufficient, In case there is a particular step that needs some wait with condition, you can try explicit or fluent waits
Hi, can I know which one is best to do automation. Katalon or by how u show it in this video ? Because I try to use katalon it is not that flexible to select the specific elements when it is comes to app
Hi Sharmilah, Katalon mobile testing is also based on Appium, it has some wrappers and gui over appium, although it's not very mature yet.. I will suggest go this way of creating your custom framework for mobile testing.
Thank you so much I have learned so much from this alone, this best explanation so far. One request for you If you could share this project with us. That would be a great help.
Thanks could you please share it with us.
Pls check this - github.com/Raghav-Pal/AppiumDemoProject
Thank you man
You're welcome Surya
Great tutorial 👌
Glad you liked it
@@RaghavPal I was just discussing your channel and your videos with one of my friend. Very helpful content you are creating hats off to you. Kya baath kya baath kya baath 😉😆.
Hi please how did you setup the output folder where all the report are stored, am using Junit and in the baseTest how will I use @AfterSuite
Hi Ifeoma, pls point the time in the video so I can refer quickly
Hi Raghav,
Which eclipse version your using, There is no testng plugin for the latest eclipse version.
Hi Seshadri, I used 2018-12 ver. Pls check this video - ruclips.net/video/yyUyi8s42dE/видео.html
Hi Raghav! Can you please let me know where to write implicit wait command in the bdd framework for Android apps? I have written after androiddriver initialisation but it is throwing an error.
Hi Akash, what is the error, You can also google it for instant help
Below is the solution worked for me for exception/error "No Chromedriver found"
Start appium server through command line using below command:
appium --allow-insecure chromedriver_autodownload
The above command will install the latest driver as per the chrome browser version on running the above test as expected.
Thanks for the inforamation Akbar
Thanks Bro!
Thank you so much !
Thanks Akbar !
Where we have to put this Command??
Hi, I got pass results after I run as TestNG, but the browser from the mobile failed to launch.
Pls check the logs for troubleshooting
getting an error, Google isn't helping.
java.lang.UnsupportedClassVersionError: Preview features are not enabled for tests/BaseClass (class file version 58.65535). Try running with '--enable-preview'
Any ideas?
Hi Mizoto, what is your java version. I was checking this online and may be this is with java 9
You may try to use a diff ver and check, In case you want to know how to install or update java, can find in my playlist on java under programming section here - automationstepbystep.com/
@@RaghavPalMy Java version is 14
@@RaghavPal I found it out.
Right click project > properties > Java Compiler> set compliance level to 1.8.
Then it worked
Glad to know this
your english is really good
I am improving.
Hi Raghav, i get "org.openqa.selenium.SessionNotCreatedException" when i run calculator tests, i have configured and set environment variables for JAVA, SDK, platform tools, tools, adb device also connected can u pls guide me how to resolve..
Hi Mohan, pls check appium server is running. And only one instance should be running. You can stop and start the server again and check. Also see this - stackoverflow.com/questions/32048031/org-openqa-selenium-sessionnotcreatedexception-a-new-session-could-not-be-creat
Hi
I am no route found.setting content type to text/plain in appium and if I type the URL in google it is showing the url '/hd/hub' did not map to valid resource
Can you please tell how to clear the error
Hi Rashmi, pls check if this helps - stackoverflow.com/questions/44410681/the-url-session-did-not-map-to-a-valid-resource-how-to-run-desktop-applicat
Hi Raghav,what about folder which we created pages and apps folder,in the above video its just created thats it no code/content added ..
Hi Ateeqh, the apps folder is to add your apk or ipa files for mobile applications and pages will contain class with element locators to create Page Object Model. I mentioned this here - ruclips.net/video/UlktcBntD6s/видео.html
for Page OBject Model - this will help - ruclips.net/video/-0F-YBAQdGE/видео.html
Complete Appium - ruclips.net/p/PLhW3qG5bs-L8npSSZD6aWdYFQ96OEduhk
simple clear and efficient, thank you very much for sharing your knowledge and your time awesome
You're very welcome Abdelhamid
hello the adb devices command does not work in the latest version of macos and I can't seem to find an alternative
will need to check on this Kashif
Hi Raghav, Thank for such a nice explanation. One query - What is the use of src/main/java and src/main/resources. Please help as I need to create a framework in my project for POC purpose. Thanks in Adance.
Hi Kapil, these are diff folders or packages. You can put your main dev code in src/main/java, your test-related scripts under src/test/java and other resources like config files, drivers, property files etc in resources
I have some doubts as mentioned below.
1. I have added dependency which you are added in this video, but I'm unable find MobileCapabilityType java file.
2. I couldnot able to declare thar appium driver variable. Unable to proceed after this
Hi Pradeep, will need to check the logs and error details, Can try some online examples
Where did the appium server come from? Did it come along with the appium java-client dependency? Or did you install it separately?
along with appium
Hi Raghav, I follow this tutorial but get "Exception in thread "main" java.lang.UnsupportedClassVersionError" when running the TestNG . I am using javac 20.0.1 and java 20.0.1, selenium 3.141.59, java-client 7.0.0, and testng 7.8.0. I am trying to find the solution for this since yesterday but still cant solve this issue. The terminal log said nothing bout this error.
Nadia
The error message "Exception in thread "main" java.lang.UnsupportedClassVersionError" means that the Java Virtual Machine (JVM) is unable to load the class because it is not compatible with the version of the JVM that is running.
This error can occur for a few reasons:
* The class file was compiled with a newer version of Java than the JVM is running.
* The class file is corrupt.
* The JVM is not configured to run Java 18.
To troubleshoot this error, you can try the following:
* Check the Java version that the class file was compiled with. You can do this by looking at the file header of the class file.
* Check the Java version that the JVM is running. You can do this by running the following command:
```
java -version
```
If the Java version that the class file was compiled with is newer than the Java version that the JVM is running, then you need to compile the class file with the older version of Java.
If the class file is corrupt, then you need to delete the class file and recompile it.
If the JVM is not configured to run Java 18, then you need to update the JVM configuration.
I hope this helps!
Hi Raghav, I am getting "Error: Could not find or load main class org.testng.TestNG" when i am trying to to do Run As- TestNG. Can you please help me here? Also i had added TestNG dependencies already
Hi Aditya, pls check if this is path related issue, Check here
stackoverflow.com/questions/17894938/getting-error-could-not-find-or-load-main-class-org-testng-testng#:~:text=Possibly%20your%20testng.,%3A%5CWorkspace%5Cprojectname%5Clib%20.&text=Check%20that%20the%20lib%20folder%20contains%20testng%2D6.8.&text=jar%20(or%20any%20other%20version)%20with%20the%20jars%20that%20gets,when%20we%20add%20TestNG%20library.
Hi Raghav Sir.. I need your help to understand where should I use interface and Abstract class while working on automation framework..?? Actually even when I know the definitions of Abstract class and interface while working alone on my automation framework I am not getting how can I bring Abstract class and interface in framework.. I follow Page object model.. pls help
I will try to create a session Surbhi, for now pls try online help
Thanks alot..
Error: Could not find or load main class org.testng.remote.RemoteTestNG
what can i do for above error message
Hi Ashok, check this - stackoverflow.com/questions/32943504/error-could-not-find-or-load-main-class-org-testng-remote-remotetestng
Thank you
Most welcome Ahmad
Hi,
After launching appium inspector , i am not able to tap on particular elements, its showing interaction are not available for thia element, and at left side it captured the screen but not able click any text field or button
Device mac
App calculator
Hi Shiva, There may be some elements hidden or inside frames, You can check the properties and DOM and try to create a locator, Can take online help too
37: 52 the test-output folder was created when you executed the test, its like the results of the test. Will I get the same test-output folder if am using Junit.
Yes, pls try
Thanks Raghav, this is Amazing session.
Can someone explain what is in driver initialiation step?
Hi Ankush, this is a class in Appium library, can check more here - discuss.appium.io/t/difference-between-webelement-mobileelement-androidelement-and-ioselement/5254
Hi
I need a little clarifucation from you, when you are ceating a web automation framework using selenium java using maven using page object model, we have a page layer and a test layer. In page layer we do have page classes in pages package and a BaseTest in a base package.
Why didn't you use the same approach in designing this mobile automation framework?
Can't we create a Base class here and inside that can't we create those desired capabilities and launching the driver method?
Then its about calling them in the test classes noh ?
Because in page object model you can't use driver apis in test layer, if you do that it happens to be a violation of page object model as per the Martin the inventor of POM.
So I am asking again why can't we use the same approach in mobile devices?
Is that because they don't have specific pages hence we cant create separate page classes?
If that so is what should be the way to create a framework then ?
Isuru
Yes, you can use the same approach in designing a mobile automation framework using Appium. The Page Object Model (POM) is a design pattern that can be used to decouple the test code from the implementation details of the application under test. It does this by creating separate classes for each page in the application. These classes contain methods for interacting with the elements on the page.
The Base class in the POM pattern is a generic class that contains common methods for all pages, such as the method for launching the driver. This class can be used in both web and mobile automation frameworks.
In the case of mobile automation, the Base class can also contain methods for configuring the device, such as setting the device name and the device orientation.
The test classes in the POM pattern should only call the methods in the Page classes. This ensures that the test code is decoupled from the implementation details of the application under test.
Here is an example of how the POM pattern can be used in a mobile automation framework:
```
public class BaseTest {
protected AppiumDriver driver;
public BaseTest() {
this.driver = new AppiumDriver();
}
public void launchApp() {
driver.launchApp();
}
public void closeApp() {
driver.closeApp();
}
}
public class HomePage extends Page {
public void clickLoginButton() {
driver.findElementById("loginButton").click();
}
}
public class LoginPage extends Page {
public void enterUsername(String username) {
driver.findElementById("username").sendKeys(username);
}
public void enterPassword(String password) {
driver.findElementById("password").sendKeys(password);
}
public void clickLoginButton() {
driver.findElementById("loginButton").click();
}
}
public class Test1 {
@Test
public void testLogin() {
BaseTest baseTest = new BaseTest();
baseTest.launchApp();
HomePage homePage = new HomePage(baseTest.driver);
homePage.clickLoginButton();
LoginPage loginPage = new LoginPage(baseTest.driver);
loginPage.enterUsername("username");
loginPage.enterPassword("password");
loginPage.clickLoginButton();
}
}
```
In this example, the BaseTest class contains the methods for launching the driver and closing the app. The HomePage class and the LoginPage class contain methods for interacting with the elements on the HomePage and the LoginPage, respectively. The Test1 class tests the login functionality of the application.
This is just one example of how the POM pattern can be used in a mobile automation framework. There are many other ways to implement the POM pattern. The best way to implement the POM pattern will depend on the specific application under test.
@@RaghavPal Thank you very much for your detailed explanation, I think your page classes should extend base class right, hope that it's by a typo that you have written it as
public class HomePage extends Page
It should be
public class HomePage extends BaseTest
Am I correct ?
go with it
Hi Raghav, Even after creating the sample test I am not getting the "Run as TestNG" option. It is still showing as 'Run Configuration'... what can be the cause? I followed exactly the same code.
Hi, for that you need to have TestNG plugin added in Eclipse and should have restarted Eclipse. Can check this ruclips.net/video/yyUyi8s42dE/видео.html
@@RaghavPal Thank you.
Yes, I have done the same and it is working.
Hi Raghav, I wanted to ask you something: In order to perform automation with appium and Java & Selenium for Apple devices you will need an Mac machine? Is it possible to perform this under Windows machine? Thanks for your great work.
Hi Gabriel,
In order to perform automation testing with Appium and Java & Selenium for Apple devices, you need a Mac machine. This is because Appium relies on Apple's XCUITest automation framework, which is only available on macOS. Therefore, if you want to automate testing on Apple devices, you will need a Mac machine to run Appium.
While it is possible to write the code for Appium using Java & Selenium on a Windows machine, you will not be able to execute the tests on an Apple device without a Mac machine. However, there are a few workarounds that allow you to perform testing on a real iOS device without a Mac machine. These include:
Using a cloud-based testing service that provides access to real iOS devices for testing. Examples of such services include Sauce Labs, BrowserStack, and Firebase Test Lab.
Using a third-party tool such as CrossBrowserTesting's Appium Studio, which provides an emulation of XCUITest on a Windows machine.
Using a virtual machine running macOS on your Windows machine. This requires you to have a licensed copy of macOS and access to a virtual machine software such as VMware or VirtualBox.
However, these workarounds may have limitations in terms of performance, reliability, and device compatibility, so it is recommended to use a physical Mac machine for Appium testing on Apple devices.
@@RaghavPal Thank you Raghav, I really appreciate your long explaining and devotion to teach!
Hi, thanks for making the videos..really helped me alot in my testing journey.
Is adding the appium.io dependency the same as appium studio? I need to use some functionality to simulate the camera, i don't think appium does this
since im doing this for mobile app automation, I do not need the selenium dependency?
Hi Hwei, you can either add appium dependency in your project or use appium studio
Hi Raghav, your video tutorials are very helpful and Thank you very much !!! Could you please do a tutorial on how to do automation testing on react native/native mobile apps? Is it differ from Android/iOS automation testing ?
Noted! I wil try
Thank you!
Hi Raghav, I am facing an error :Process finished with exit code 255 ,org.testng.TestNGException: (in IntelliJ),can you help me to fix the error
Hi Sowmya, can check this
stackoverflow.com/questions/27654407/automated-test-fails-on-button-click
You may need to do some more online search to find a final solution
Good one!
Can you help me on this please, I see adb is not recognized in command prompt when i search for adb devices. I have verified the system variables and also path, adb is placed inside platform-tools.
Hi Muhthar, Pls check if you have set path of adb in env variables (system variables)
Pls check this : stackoverflow.com/questions/8744758/adb-is-not-recognized-as-internal-or-external-command-on-windows
Hi Raghav thank you agin for this courses.
I faced an issue which was => "No Chromedriver found that can automate Chrome '81.0.4044'"
I fixed by adding this deviceCap in the Setup() => caps.setCapability("chromedriverExecutable", "C:\\ChromeDrivers\\81.0.4044.138\\chromedriver.exe");
What I'm looking for is way to skip this step. There's such thing ?
Thx
Hi Haider, If you add the path of the chromederver.exe in Path env variable, you may try to skip this
Thanks for reply i have viewed your complete playlist but still i am feeling its not enough.Can you please upload a project tutorial so that a lot of queries would be resolve
Sure Hassan, I will plan to make a more detailed project video. You can also check existing here - automationstepbystep.com/
Hi Raghav,
I am getting following error can you help on this.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Could not find 'aapt' in PATH. Please set the ANDROID_HOME environment variable with the Android SDK root directory path.
Hi, aapt.exe is the Android Asset Packaging Tool and is part of the Android SDK. Can you confirm that you have aapt.exe somewhere on your machine? There are specific directories that the script is looking in to find it. You might want to try reinstalling the Android SDK.
I was reading some posts that aapt.exe may be named aapt2.exe for some SDKs. Could you check to see if that file exists on your system? You should be able to find it in:
C:\Users\\AppData\Local\Android\sdk\build-tools\
If it does exist, you might be able to create a shortcut named “aapt.exe” to that file.
forum.katalon.com/t/could-not-find-aapt-exe/10922/10
A user solved it using below steps:
1 I installed Android Studio and
2 installed SDK from Android Studio.
export ANDROID_HOME=/Users/darya1/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
3 Edit the configuration setting of Appium server to point to the ANDROID_HOME and JAVA_HOME.
Thank you for the tutorial Raghav. May I know if you have the same tutorial for Native app. I mean setting up the TestNG framework with android or ios native apps.
Hi Vinay, yet to do on native apps
Automation Step by Step - Raghav Pal please Raghav can you make more videos on Appium .
Hi Raghav, It seems the video link for adding "TestNG to eclipse" is redirecting to some other youtube channel. Please check
Thanks for letting me know Sowmya, I have updated
How to automate android apps using VPS without VT virtualization? is there any custom images?
thanks
will need to check on that
Hi, i have a problem, Error: Could not find or load main class org.testng.remote.RemoteTestNG ?
I Add TestNG Plugin In Eclipse. I add selenium version 3.141.59, appium version 7.3.0, testng version 6.14.3 in pom.xml . please help me !
Hi Thắng, did you add testng in pom dependency.
Pls check this - stackoverflow.com/questions/32943504/error-could-not-find-or-load-main-class-org-testng-remote-remotetestng
@@RaghavPal Hi Raghav, i added file testng.xml . Thank you so much !
In web automation we used to write .xml config file right. Here mobile automation not required that approach?
Suresh
In web automation, XML configuration files are often used to manage settings and parameters for test frameworks like Selenium. However, in mobile automation with Appium, the approach can be different. Appium typically uses desired capabilities, which are a set of key-value pairs that define the context of the test run. These capabilities can be written in JSON format and included directly in your test code or in a separate JSON file.
Here's an example of how desired capabilities might look in a JSON file for an Appium test:
```json
{
"platformName": "Android",
"platformVersion": "11.0",
"deviceName": "Android Emulator",
"app": "/path/to/your/app.apk",
"automationName": "UiAutomator2"
}
```
You would then load these capabilities in your test setup. For instance, in Java, you might use the `DesiredCapabilities` class to load them:
```java
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "11.0");
capabilities.setCapability("deviceName", "Android Emulator");
capabilities.setCapability("app", "/path/to/your/app.apk");
capabilities.setCapability("automationName", "UiAutomator2");
AppiumDriver driver = new AndroidDriver(new URL("127.0.0.1:4723/wd/hub"), capabilities);
```
This approach is different from traditional web automation, where XML configuration files might be used more extensively. In Appium, JSON is preferred for defining capabilities because it is more concise and integrates well with the programming languages commonly used for writing tests (like Java, Python, etc.).
Hi Raghav, I am getting the below error . Could you please help?
An unknown server-side error occurred while processing the command. Original error: No Chromedriver found that can automate Chrome '69.0.3497'
Thanks
Hi Hrushikesh, If you are doing browser testing on chrome, you will need to add chromebrowser driver
Hello, i have a problem, my chrome is version 76 but the driver is complaining that it only supports versions 71-75. Do i just wait for an updated driver or is there a workaround?
You can try with a diff ver of chrome driver chromedriver.chromium.org/downloads
@@RaghavPal i have the same problem.i have tried with several versions .unfortunately in vain
Hi iam getting this error while executing maven project in Appium desktop "[W3C] Encountered internal error running command: Error: Could not find 'aapt' in ["/usr/local/share/android-sdk/platform-tools/aapt"
Hi Arun,
aapt.exe is the Android Asset Packaging Tool and is part of the Android SDK. Can you confirm that you have aapt.exe somewhere on your machine? There are specific directories that the script is looking in to find it. You might want to try reinstalling the Android SDK.
I was reading some posts that aapt.exe may be named aapt2.exe for some SDKs. Could you check to see if that file exists on your system? You should be able to find it in:
C:\Users\\AppData\Local\Android\sdk\build-tools\
If it does exist, you might be able to create a shortcut named “aapt.exe” to that file.
forum.katalon.com/t/could-not-find-aapt-exe/10922/10
A user solved it using below steps:
1 I installed Android Studio and
2 installed SDK from Android Studio.
export ANDROID_HOME=/Users/darya1/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
3 Edit the configuration setting of Appium server to point to the ANDROID_HOME and JAVA_HOME.
Good video Raghav
Thanks Dhiraj
@@RaghavPal Do you have a full course that can cover every mobile testing concepts ?
Hi Raghav, first of all Thank u so much for the wonderful lectures, Please help me as while executing I am getting ""TestNG by default disables loading DTD from unsecured URLs. If you need to explicitly load the DTD from a http url, please do so by using the JVM argument [-Dtestng.dtd.http=true]" error.. please help
Hi Anti, check this stackoverflow.com/questions/57299606/testng-by-default-disables-loading-dtd-from-unsecure-urls
hi raghav your tutorials is very helpful buddy, can you make a video on swipe coordinates of appium with java??? i searched on youtube but didn't find a single helpful tutorial about it.... both vertical and horizontal swipe please... thanks
Hi, I will work on this, but can take some time
@@RaghavPal okay
Can you use one driver for both android and iOS or is their a work around ? or is it not possible to write 1 test for android and iOS
Hi Sidney, you will need to do some changes in Desired Capabilities, Can put this in a condition
Hi, this video has been posted 4 years back , in this year 2024 am planning to do android mobile application testing using Appium, Cucumber framework and java language which is the best IDE to use eclipse or InteliJ, Please assist me, it would be a great advice for me, thanks in advance!
Maha Lakshmi
Now we have Appium 2 and there are changes. I will plan to create new sessions as soon as possible.
The current sessions will also help