Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For me not getting how to navigate the once the app was login and home page is displayed but for me not getting how to navigate home page to another page #2198

Open
3 tasks done
darshan210796 opened this issue Jul 11, 2024 · 0 comments
Labels

Comments

@darshan210796
Copy link

Do I have the most recent component updates?

  • I use the most recent available driver/plugin and server versions

Is the component officially supported by the Appium team?

  • I have verified the component repository is present under the Appium organization in GitHub

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I have written base test code like this
package Daakia.Virtualdevice;

import java.net.MalformedURLException;
import java.net.URL;
import java.time.Duration;

import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;

import io.appium.java_client.android.AndroidDriver;

import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import io.appium.java_client.MobileElement;

public class Basetest {
public static AndroidDriver driver;

 @BeforeClass
    public void ConfigureAppium() {
	 
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability("deviceName", "darshan");
        capabilities.setCapability("platformName", "Android");
        capabilities.setCapability("app", "C:\\apk\\Daakia-17.0-prod-release.apk");
        capabilities.setCapability("automationName", "UiAutomator2");
        capabilities.setCapability("appPackage", "com.app.daakia");
       capabilities.setCapability("appActivity", "com.daakia.ui.CreateEventActivity");
       capabilities.setCapability("newCommandTimeout", 300);
       capabilities.setCapability("adbExecTimeout", 120000);
       capabilities.setCapability("uiautomator2ServerLaunchTimeout", 120000);
     //   capabilities.setCapability("appActivity", "com.daakia.ui.ConversationActivity");

        try {
            URL url = new URL("http://127.0.0.1:4723/wd/hub");
            driver = new AndroidDriver(url, capabilities);
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
    }
 public void navigateToOtherTab() throws InterruptedException {
        // Wait for the home screen to load
        WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));
        WebElement homeScreenElement = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("com.app.daakia:id/navigation_bar_item_large_label_view")));
        homeScreenElement.click();


        // Click on the tab to navigate to it
        WebElement eventsTabElement = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("com.app.daakia:id/navigation_bar_item_icon_view")));   	
        		
        eventsTabElement.click();
 }

}

I have written code for SplashActivity page

package Daakia.Virtualdevice;

import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import java.time.Duration;
import java.util.concurrent.TimeUnit;

import org.testng.Assert;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.WebDriverWait;

import io.appium.java_client.AppiumBy;
import io.appium.java_client.MobileElement;

public class SplashActivity extends Basetest{

@BeforeClass
public void setUp() {
	DesiredCapabilities capabilities = new DesiredCapabilities();
	capabilities.setCapability("appPackage", "com.app.daakia");
    capabilities.setCapability("appActivity", "com.daakia.ui.SplashActivity");
    
}

@Test
public void testSplashScreen() throws InterruptedException  {
	 //   driver.findElement(By.id("com.app.daakia:id/fabWelcome")).click();
    //  Thread.sleep(4000);
    //  driver.findElement(By.id("com.app.daakia:id/primary_button")).click();
    //  Thread.sleep(2000);
    //  driver.findElement(By.id("com.app.daakia:id/fabWelcome")).click();
  //    Thread.sleep(6000);
  //  driver.findElement(By.id("com.app.daakia:id/primary_button")).click();
   //   driver.findElement(By.id("com.app.daakia:id/fabWelcome")).click();
    //  Thread.sleep(2000);
   //   driver.findElement(By.id("com.app.daakia:id/fabWelcome")).click();
   //   Thread.sleep(2000);
     driver.findElement(By.id("com.app.daakia:id/txtSkip")).click();    	
      Thread.sleep(4000);
      driver.findElement(By.id("com.app.daakia:id/tvContinueNow")).click();
      Thread.sleep(2000);
      driver.findElement(By.id("com.android.permissioncontroller:id/permission_allow_button")).click();
     Thread.sleep(2000);
     
   //    driver.findElement(By.id("com.app.daakia:id/primary_button")).click();
      driver.findElement(By.id("com.app.daakia:id/btnStartChat")).click();
      Thread.sleep(2000);
      driver.findElement(By.id("com.app.daakia:id/editTextPhoneNumber")).sendKeys("8686868686");
     
      Thread.sleep(1000);
      driver.findElement(By.id("com.app.daakia:id/txtPrivacyCheckbox")).click();
      Thread.sleep(1000);
 //     driver.findElement(By.id("com.app.daakia:id/buttonNext")).click();
 //     driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
      WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(120));
      WebElement buttonNext = wait.until(ExpectedConditions.elementToBeClickable(By.id("com.app.daakia:id/buttonNext")));
      buttonNext.click();
  //  driver.manage().timeouts().implicitlyWait(driver, Duration.ofSeconds(10));
   //   driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
      WebDriverWait wait1 = new WebDriverWait(driver, Duration.ofSeconds(120));
      WebElement otpViewElement = wait1.until(ExpectedConditions.visibilityOfElementLocated(By.id("com.app.daakia:id/otpView")));
      otpViewElement.sendKeys("555555");
      Thread.sleep(8000);
   
      
     driver.findElement(By.id("com.app.daakia:id/editTextLaunguage")).click();
      Thread.sleep(4000);
      driver.findElement(By.id("com.app.daakia:id/edtSearch")).sendKeys("kannada");
      Thread.sleep(2000);
      driver.findElement(By.id("com.app.daakia:id/radioLanguage")).click();
      Thread.sleep(2000);
 
      WebDriverWait wait2 = new WebDriverWait(driver, Duration.ofSeconds(120));
      WebElement buttonNext1 = wait.until(ExpectedConditions.elementToBeClickable(By.id("com.app.daakia:id/buttonFinish")));
      buttonNext1.click();
   //   driver.findElement(By.id("com.app.daakia:id/buttonFinish")).click();
   //   Thread.sleep(10000);
  //    driver.findElement(By.id("com.app.daakia:id/skip")).click();
      Thread.sleep(10000);
      driver.findElement(By.id("com.app.daakia:id/tvGotIt")).click();    	
  	
      
      Thread.sleep(4000);
      driver.findElement(By.id("com.app.daakia:id/tvGotIt")).click();
      Thread.sleep(4000);
      driver.findElement(By.id("com.app.daakia:id/tvGotIt")).click();
      Thread.sleep(4000);
      driver.findElement(By.id("android:id/button2")).click();
      Thread.sleep(2000);
	 navigateToOtherTab();
}
	 
	 public void navigateToOtherTab() throws InterruptedException {
	       
	        WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));
	        WebElement homeScreenElement = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("(//android.widget.FrameLayout[@content-desc=\\\"Chats\\\"])")));
	        homeScreenElement.click();

	        driver.findElement(By.xpath("(//android.widget.FrameLayout[@content-desc=\\\"Events\\\"])")).click(); // Replace with actual tab ID
	        

}

}

I have written code for event page

package Daakia.Virtualdevice;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.AndroidMobileCapabilityType;
import io.appium.java_client.remote.MobileCapabilityType;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.Test;

import java.net.MalformedURLException;
import java.net.URL;
import java.time.Duration;

public class Eventtest extends SplashActivity{
public static void main(String[] args) throws MalformedURLException {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
caps.setCapability(MobileCapabilityType.DEVICE_NAME, "darshan");
caps.setCapability(MobileCapabilityType.APP, "C:\apk\Daakia-17.0-prod-release.apk");
caps.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.daakia.ui.CreateEventActivity");
caps.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.app.daakia");

        // Initialize the driver
        try {
            URL url = new URL("http://127.0.0.1:4723/wd/hub");
            driver = new AndroidDriver(url, caps);
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
 }

        @Test
    	public void EventTest() throws MalformedURLException, InterruptedException 
    	{
	        WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));
	        WebElement startDaakButton = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("com.app.daakia:id/fabOpenChat")));
	        startDaakButton.click();
    //		driver.findElement(By.id("com.app.daakia:id/eventsFragment")).click(); 
    //        Thread.sleep(2000);
    //        driver.findElement(By.id("com.app.daakia:id/fabOpenChat")).click(); 
    //        Thread.sleep(2000);
            driver.findElement(By.id("com.app.daakia:id/eventNameEt")).sendKeys("Testing 1");
            Thread.sleep(2000);
            driver.findElement(By.id("com.app.daakia:id/hostNameEt")).sendKeys("darshan");   	
            Thread.sleep(2000);
            driver.findElement(By.id("com.app.daakia:id/topicEt")).sendKeys("QA Testing");
            Thread.sleep(2000);
            driver.findElement(By.id("com.app.daakia:id/dateFromEtTv")).click();
            Thread.sleep(2000);
            driver.findElement(By.xpath("(//android.view.View[@content-desc=\"09 July 2024\"])")).click();
            Thread.sleep(2000);
            driver.findElement(By.id("android:id/button1")).click();
            Thread.sleep(2000);
           
            driver.findElement(By.id("com.app.daakia:id/dateToEtTv")).click();   	
            Thread.sleep(2000);
            
            driver.findElement(By.xpath("(//android.widget.RadialTimePickerView.RadialPickerTouchHelper[@content-desc=\"13\"])")).click();
       //     Thread.sleep(2000);
       //     driver.findElement(By.id("android:id/minutes")).click();
            Thread.sleep(2000);
            driver.findElement(By.xpath("(//android.widget.RadialTimePickerView.RadialPickerTouchHelper[@content-desc=\"50\"])")).click();     	
          
            Thread.sleep(2000);
            driver.findElement(By.id("android:id/button1")).click();
            Thread.sleep(2000);
            driver.findElement(By.id("com.app.daakia:id/addParticipantEt")).click();  
            Thread.sleep(2000);
            driver.findElement(By.id("com.app.daakia:id/emailET")).sendKeys("[email protected]"); 
            Thread.sleep(2000);
            driver.findElement(By.id("com.app.daakia:id/submit")).click();
            Thread.sleep(2000);
            driver.findElement(By.id("com.app.daakia:id/buttonCreate")).click();
            Thread.sleep(2000);
            driver.findElement(By.id("com.android.permissioncontroller:id/permission_allow_button")).click();
            Thread.sleep(2000);
            driver.findElement(By.id("com.google.android.gms:id/account_name")).click();
            Thread.sleep(6000);
            driver.findElement(By.xpath("(//android.widget.ImageButton[@content-desc=\"Navigate up\"])"));   
          
        driver.quit();
    }
}

Expected Behavior

Like this error is getting

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.app.daakia' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command ''C:\Users\Dashan K N\AppData\Local\Android\Sdk\platform-tools\adb.exe' -P 5037 -s emulator-5554 shell am start -W -n com.app.daakia/com.daakia.ui.CreateEventActivity -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000' exited with code 255'; Command output:
Exception occurred while executing 'start':
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.app.daakia/com.daakia.ui.CreateEventActivity } from null (pid=4281, uid=2000) not exported from uid 10157
at com.android.server.wm.ActivityTaskSupervisor.checkStartAnyActivityPermission(ActivityTaskSupervisor.java:1059)
at com.android.server.wm.ActivityStarter.executeRequest(ActivityStarter.java:983)
at com.android.server.wm.ActivityStarter.execute(ActivityStarter.java:672)
at com.android.server.wm.ActivityTaskManagerService.startActivityAndWait(ActivityTaskManagerService.java:1493)
at com.android.server.am.ActivityManagerService.startActivityAndWait(ActivityManagerService.java:2975)
at com.android.server.am.ActivityManagerShellCommand.runStartActivity(ActivityManagerShellCommand.java:567)
at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:201)
at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
at android.os.ShellCommand.exec(ShellCommand.java:38)
at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:8738)
at android.os.Binder.shellCommand(Binder.java:950)
at android.os.Binder.onTransact(Binder.java:834)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:5167)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2517)
at android.os.Binder.execTransactInternal(Binder.java:1184)
at android.os.Binder.execTransact(Binder.java:1143)

Host info: host: 'DESKTOP-IOI875F', ip: '172.31.48.1'
Build info: version: '4.8.0', revision: '267030adea'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.6'
Driver info: io.appium.java_client.android.AndroidDriver
Command: [null, newSession {capabilities=[{appium:app=C:\apk\Daakia-17.0-prod-release.apk, appium:appActivity=com.daakia.ui.CreateEventActivity, appium:appPackage=com.app.daakia, appium:deviceName=darshan, platformName=ANDROID}], desiredCapabilities=Capabilities {app: C:\apk\Daakia-17.0-prod-rel..., appActivity: com.daakia.ui.CreateEventAc..., appPackage: com.app.daakia, deviceName: darshan, platformName: ANDROID}}]
Capabilities {}
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:148)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.appium.java_client.remote.AppiumProtocolHandshake.createSession(AppiumProtocolHandshake.java:133)
at io.appium.java_client.remote.AppiumProtocolHandshake.createSession(AppiumProtocolHandshake.java:102)
at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:182)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:250)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:274)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:157)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:89)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:101)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:113)
at Daakia.Virtualdevice.Eventtest.main(Eventtest.java:30)

Minimal Reproducible Example

Please give the solution for this error how to navigate home page to other page

Environment

  • Operating system:
  • Appium server version (output of appium --version):
  • Appium driver(s) and their version(s) (appium driver list):
  • Appium plugin(s) and their version(s) (appium plugin list):
  • Node.js version (output of node --version):
  • npm version (output of npm --version):
  • Last component(s) version which did not exhibit the problem:
  • Platform and version under test:
  • Real device or emulator/simulator:

Link to Appium Logs

No response

Further Information

No response

@mykola-mokhnach mykola-mokhnach transferred this issue from appium/appium Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant