How to launch new activity for Appium Android

0 votes

How to switch from one Activity to another Activity within the application?

@Note: I am using TESTNG framework.

Below is my code.

    String settingsAppPackageName="com.xxx.xxx.xxxx.dashBoard";

    String settingsAppActivityName="com.xxxx.xxxx.xxx.xxx.DashBoard";

     @Test(priority = 1)

    public void loginTC2(){

         System.out.println("Login 3333::>"+driver.currentActivity());

         if(driver.currentActivity().equals("com.xxx.xxx.xxxx.login.LoginActivity")){

             System.out.println("Login 6666::>"+driver.currentActivity());

             driver.findElement(By.id("com.xxxx.xxxx.xxxx:id/edtUserName")).sendKeys("xxxx");

            driver.findElement(By.id("com.xxxx.xxxx.xxxx:id/edtPassword")).sendKeys("xxxx");

            driver.findElement(By.id("com.xxxx.xxxx.xxxx:id/btnLogin")).click();

             // If action is executed then I want to navigate to DashboardActivity

            driver.startActivity(settingsAppPackageName, settingsAppActivityName);

         }else{

            System.out.println("Login 4444::>"+driver.currentActivity());

         }

    }
Jun 4, 2018 in Selenium by Martin
• 4,320 points
3,730 views

1 answer to this question.

0 votes

Firstly, test if the activity you want is launching:

adb shell am start -n <app_package_name>/<full_activity_name>

If it goes like Starting: Intent {<>} without errors and you can see app launched on emulator/device, then you I ready to go with Appium.

answered Jun 4, 2018 by Samarpit
• 5,910 points

Related Questions In Selenium

0 votes
1 answer

How to I switch to a new window for links with “blank” targets using Capybara?

Capybara 2.3 includes the new window management ...READ MORE

answered Jul 11, 2018 in Selenium by Meci Matt
• 9,460 points
3,871 views
0 votes
1 answer

How to apply wait for new window using Selenium WebDriver?

As sometimes during web automation, when you ...READ MORE

answered Jul 10, 2019 in Selenium by Vaishali Walia
9,158 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,676 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,144 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,221 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,875 views
0 votes
1 answer

How to eleiminate Selenium NoClassDefFoundError for SSLContext?

You need to upgrade the httpCore dependency ...READ MORE

answered May 4, 2018 in Selenium by Samarpit
• 5,910 points
3,228 views
0 votes
1 answer

How to get next sibling element using XPath and Selenium for Java?

Below code will help you: Try following-sibling axis : WebElement ...READ MORE

answered May 15, 2018 in Selenium by Samarpit
• 5,910 points
20,813 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP