Welcome back to Appium tutorials in this post we will discuss how to scroll in Appium.
Recently I got an application where I had to scroll down to click on that element.
I have worked on web application automation extensively so I used to do with JavaScript Executor.
If you have never used Java Script Executor then I would highly recommend to check below the article.
It helped me for Highlighting elements, Scroll into View, Scroll pages and so on.
But I become helpless when I switched to Mobile application because above methods were not working for me.
Methods for Scroll in Appium
I did some googling and found that AndroidDriver class has inbuilt method which performs scroll till the element not found.
Please check the Appium reference where you can find multiple articles on Appium
Complete Appium guide for IOS and Android
Please check below Screenshot.
First Method-
As you can see the description this will scroll until element not found with text.
Second Method
This method also will perform scroll method but this will search for exact text for scrolling.
Program for Scroll in Appium
public class TestHybrid5 { private static AndroidDriver driver; public static void main(String[] args) throws MalformedURLException, InterruptedException { File classpathRoot = new File(System.getProperty("user.dir")); File appDir = new File(classpathRoot,"/app"); File app = new File(appDir,"appname.apk"); // Create object of DesiredCapabilities class DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("app", app.getAbsolutePath()); // Optional capabilities.setCapability(CapabilityType.BROWSER_NAME, ""); // Specify the device name (any name) capabilities.setCapability("deviceName", "My New Phone"); // Platform version capabilities.setCapability("platformVersion", "6.0"); // platform name capabilities.setCapability("platformName", "Android"); // specify the application package that we copied from appium capabilities.setCapability("appPackage", "app Package name"); // specify the application activity that we copied from appium capabilities.setCapability("appActivity", "specify the activity here"); // Start android driver default it will be 4723 driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); // Specify the implicit wait of 5 second driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); // scrollTo("") this method will scroll automatically until specific text is not matching. // We have two methods so depends on your requirement you can use accordingly. driver.scrollTo("SAVE"); driver.findElement(By.id("app_id_screen_save_button")).click(); } }
This is very small article but a very helpful. Try from your side and let me know if an issue in Appium.
Recently I launched blog for discussion http://forumsforqa.com/
Biswa bhusan Mishra says
Nice One Mukesh..Waiting to see some advanced action related script.
Mukesh otwani says
Sure Biswa will upload soon
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Mukesh Otwani says
Test Comment
Selenium learner says
Thanks Mukesh Nice post.
Mukesh Otwani says
Thanks Keep visting.
Tarun Tiwari says
Can you please update swipe event on mobile.