Appium scripts are getting failed, after hitting url successful.
Selenium Oxygen 2
Appium version 1.2.7
Url hit the browser open the link, after some page gates refreshed and then again url reopened in new tab within the same chrome browser.
url " us.justdial.com" opeing in the chrome browser still scripts are getting failed. Have already updated chrome driver.
Below are the scripts
import java.net.MalformedURLException;
import java.net.URL;
//import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeUnit;
/*import org.openqa.selenium.Capabilities;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriver.Timeouts;
import org.openqa.selenium.chrome.ChromeDriver;*/
//import org.openqa.selenium.android.AndroidDriver;
//import org.openqa.selenium.remote.BrowserType;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
//import org.openqa.selenium.remote.RemoteWebDriver;
//import org.openqa.selenium.remote.RemoteWebDriver;
//import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;
//import io.appium.java_client.remote.MobileCapabilityType;
public class Appium_device {
//String driverPath = "F:/ChromeDriver/chromedriver.exe";
public AppiumDriver driver;
#Test
public void Appium_device() throws MalformedURLException, Exception {
{
// APPLICATION_LOG.info("Initializing project properties");
DesiredCapabilities capabilities = new DesiredCapabilities();
// Set android deviceName desired capability. Set your device name.
// capabilities.setCapability("deviceName", "5203a1bbea4a8385");
// capabilities.setCapability("deviceName", "4100df0accbd9f00");
// capabilities.setCapability("deviceName", "0123456789ABCDEF");
capabilities.setCapability("deviceName", "4d007af54ac04177");
// Set BROWSER_NAME desired capability. It's Android in our case here.
capabilities.setCapability(CapabilityType.BROWSER_NAME, "Android");
// capabilities.setCapability("browsername", "chrome");
capabilities.setCapability("chromedriverExecutable", "C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe");
// Set android VERSION desired capability. Set your mobile device's OS version.
// capabilities.setCapability(CapabilityType.VERSION, "4.2.2");
// capabilities.setCapability(CapabilityType.VERSION, "6.0.1");
capabilities.setCapability(CapabilityType.VERSION, "6.0.1");
// Set android platformName desired capability. It's Android in our case here.
capabilities.setCapability("platformName", "Android");
// Set android appPackage desired capability. It is
// com.android.calculator2 for calculator application.
// Set your application's appPackage if you are using any other app.
// capabilities.setCapability("appPackage", "org.mozilla.firefox");
capabilities.setCapability("appPackage", "com.android.chrome");
// Set android appActivity desired capability. It is
// com.android.calculator2.Calculator for calculator application.
// Set your application's appPackage if you are using any other app.
capabilities.setCapability("appActivity", "com.google.android.apps.chrome.Main");
// Created object of RemoteWebDriver will all set capabilities.
// Set appium server address and port number in URL string.
// It will launch calculator app in android device.
// webdriver.Chrome(executable_path='C:\Users\Ganeshkumarg\Downloads\chromedriver_win32\chromedriver.exe');
// RemoteWebDriver webDriver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
// webDriver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
try {
driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"),capabilities);
}catch(MalformedURLException e)
{
e.printStackTrace();
}
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
System.out.println("Step 9");
try {
driver.get("https://us.justdial.com");
System.out.println("site hit");
}
catch (Exception e) {
System.out.println("site not accessed");
throw (e);
// TODO: handle exception
}
}
}
}
Following are the appium error logs
[Appium] Welcome to Appium v1.7.1
[Appium] Non-default server args:
[Appium] address: 127.0.0.1
[Appium] Appium REST http interface listener started on 127.0.0.1:4723
[HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"appActivity":"com.google.android.apps.chrome.Main","appPackage":"com.android.chrome","browserName":"Android","chromedriverExecutable":"C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe","deviceName":"4d007af54ac04177","platformName":"Android","version":"6.0.1"},"capabilities":{"desiredCapabilities":{"appActivity":"com.google.android.apps.chrome.Main","appPackage":"com.android.chrome","browserName":"Android","chromedriverExecutable":"C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe","deviceName":"4d007af54ac04177","platformName":"Android","version":"6.0.1"},"firstMatch":[{"browserName":"Android","platformName":"android"}]}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"appActivity":"com.google.android.apps.chrome.Main","appPackage":"com.android.chrome","browserName":"Android","chromedriverExecutable":"C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe","deviceName":"4d007af54ac04177","platformName":"Android","version":"6.0.1"},null,{"desiredCapabilities":{"appActivity":"com.google.android.apps.chrome.Main","appPackage":"com.android.chrome","browserName":"Android","chromedriverExecutable":"C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe","deviceName":"4d007af54ac04177","platformName":"Android","version":"6.0.1"},"firstMatch":[{"browserName":"Android","platformName":"android"}]}]
[BaseDriver] Event 'newSessionRequested' logged at 1515140901130 (13:58:21 GMT+0530 (India Standard Time))
[Appium] Creating new AndroidDriver (v1.28.1) session
[Appium] Capabilities:
[Appium] appActivity: 'com.google.android.apps.chrome.Main'
[Appium] appPackage: 'com.android.chrome'
[Appium] browserName: 'Android'
[Appium] chromedriverExecutable: 'C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe'
[Appium] deviceName: '4d007af54ac04177'
[Appium] platformName: 'Android'
[Appium] version: '6.0.1'
[BaseDriver] The following capabilities were provided, but are not recognized by appium: version.
[BaseDriver] Session created with session id: b284c843-d3e4-4d13-94aa-a9f752377fe8
[AndroidDriver] Getting Java version
[AndroidDriver] Java version is: 1.8.0_144
[ADB] Checking whether adb is present
[ADB] Using adb.exe from C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe
[AndroidDriver] Retrieving device list
[ADB] Trying to find a connected android device
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[AndroidDriver] Using device: 4d007af54ac04177
[ADB] Checking whether adb is present
[ADB] Using adb.exe from C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe
[ADB] Setting device id to 4d007af54ac04177
[AndroidDriver] App file was not listed, instead we're going to run com.android.chrome directly on the device
[AndroidDriver] Checking whether package is present on the device
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","pm","list","packages","com.android.chrome"]
[AndroidDriver] Starting Android session
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","wait-for-device"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","echo","ping"]
[Logcat] Starting logcat capture
[AndroidDriver] Pushing settings apk to device...
[ADB] Uninstalling and re-installing 'io.appium.settings'
[ADB] Uninstalling io.appium.settings
[ADB] Getting install status for io.appium.settings
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","pm","list","packages","io.appium.settings"]
[ADB] App is installed
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","am","force-stop","io.appium.settings"]
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","uninstall","io.appium.settings"]
[ADB] ADB command output: Success
[ADB] io.appium.settings was successfully uninstalled
[ADB] Getting install status for io.appium.settings
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","pm","list","packages","io.appium.settings"]
[ADB] App is not installed
[ADB] App 'C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\io.appium.settings\app\build\outputs\apk\settings_apk-debug.apk' not installed. Installing
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","install","C:\\Users\\vaibhavsi\\AppData\\Local\\Programs\\appium-desktop\\resources\\app\\node_modules\\appium\\node_modules\\io.appium.settings\\app\\build\\outputs\\apk\\settings_apk-debug.apk"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","getprop","ro.build.version.sdk"]
[ADB] Current device property 'ro.build.version.sdk': 23
[ADB] Device API level: 23
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","dumpsys","package","io.appium.settings"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","pm","dump","io.appium.settings"]
[ADB] Got the following command chunks to execute: pm,grant,io.appium.settings,android.permission.INTERNET,;,pm,grant,io.appium.settings,android.permission.CHANGE_NETWORK_STATE,;,pm,grant,io.appium.settings,android.permission.ACCESS_NETWORK_STATE,;,pm,grant,io.appium.settings,android.permission.READ_PHONE_STATE,;,pm,grant,io.appium.settings,android.permission.WRITE_SETTINGS,;,pm,grant,io.appium.settings,android.permission.CHANGE_WIFI_STATE,;,pm,grant,io.appium.settings,android.permission.ACCESS_WIFI_STATE,;,pm,grant,io.appium.settings,android.permission.ACCESS_FINE_LOCATION,;,pm,grant,io.appium.settings,android.permission.ACCESS_COARSE_LOCATION,;,pm,grant,io.appium.settings,android.permission.ACCESS_MOCK_LOCATION,;,pm,grant,io.appium.settings,android.permission.SET_ANIMATION_SCALE,;
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","pm","grant","io.appium.settings","android.permission.INTERNET",";","pm","grant","io.appium.settings","android.permission.CHANGE_NETWORK_STATE",";","pm","grant","io.appium.settings","android.permission.ACCESS_NETWORK_STATE",";","pm","grant","io.appium.settings","android.permission.READ_PHONE_STATE",";","pm","grant","io.appium.settings","android.permission.WRITE_SETTINGS",";","pm","grant","io.appium.settings","android.permission.CHANGE_WIFI_STATE",";","pm","grant","io.appium.settings","android.permission.ACCESS_WIFI_STATE",";","pm","grant","io.appium.settings","android.permission.ACCESS_FINE_LOCATION",";","pm","grant","io.appium.settings","android.permission.ACCESS_COARSE_LOCATION",";","pm","grant","io.appium.settings","android.permission.ACCESS_MOCK_LOCATION",";","pm","grant","io.appium.settings","android.permission.SET_ANIMATION_SCALE",";"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","ps"]
[ADB] Device API level: 23
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","am","start","-W","-n","io.appium.settings/.Settings","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"]
[ADB] Device API level: 23
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","appops","set","io.appium.settings","android:mock_location","allow"]
[AndroidDriver] Pushing unlock helper app to device...
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","install","C:\\Users\\vaibhavsi\\AppData\\Local\\Programs\\appium-desktop\\resources\\app\\node_modules\\appium\\node_modules\\appium-unlock\\bin\\unlock_apk-debug.apk"]
[ADB] Getting device platform version
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","getprop","ro.build.version.release"]
[ADB] Current device property 'ro.build.version.release': 6.0.1
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","wm","size"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","getprop","ro.product.model"]
[ADB] Current device property 'ro.product.model': SM-G900H
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","getprop","ro.product.manufacturer"]
[ADB] Current device property 'ro.product.manufacturer': samsung
[AndroidDriver] No app sent in, not parsing package/activity
[AndroidDriver] No app capability. Assuming it is already on the device
[AndroidDriver] Running fast reset (stop and clear)
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","am","force-stop","com.android.chrome"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","pm","clear","com.android.chrome"]
[AndroidBootstrap] Watching for bootstrap disconnect
[ADB] Forwarding system: 4724 to device: 4724
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","forward","tcp:4724","tcp:4724"]
[UiAutomator] Starting UiAutomator
[UiAutomator] Moving to state 'starting'
[UiAutomator] Parsing uiautomator jar
[UiAutomator] Found jar name: 'AppiumBootstrap.jar'
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","push","C:\\Users\\vaibhavsi\\AppData\\Local\\Programs\\appium-desktop\\resources\\app\\node_modules\\appium\\node_modules\\appium-android-bootstrap\\bootstrap\\bin\\AppiumBootstrap.jar","/data/local/tmp/"]
[ADB] Attempting to kill all uiautomator processes
[ADB] Getting all processes with uiautomator
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","ps"]
[ADB] No uiautomator process found to kill, continuing...
[UiAutomator] Starting UIAutomator
[ADB] Creating ADB subprocess with args: ["-P",5037,"-s","4d007af54ac04177","shell","uiautomator","runtest","AppiumBootstrap.jar","-c","io.appium.android.bootstrap.Bootstrap","-e","pkg","com.android.chrome","-e","disableAndroidWatchers",false,"-e","acceptSslCerts",false]
[UiAutomator] Moving to state 'online'
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Registered crash watchers.
[AndroidBootstrap] Android bootstrap socket is now connected
[ADB] Getting connected devices...
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Client connected
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","dumpsys","window"]
[AndroidDriver] Screen already unlocked, doing nothing
[ADB] Device API level: 23
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","am","start","-W","-n","com.android.chrome/com.google.android.apps.chrome.Main","-S"]
[Appium] New AndroidDriver session created successfully, session b284c843-d3e4-4d13-94aa-a9f752377fe8 added to master session list
[BaseDriver] Event 'newSessionStarted' logged at 1515140936767 (13:58:56 GMT+0530 (India Standard Time))
[MJSONWP] Responding to client with driver.createSession() result: {"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"appActivity":"com.google.android.apps.chrome.Main","appPackage":"com.android.chrome","browserName":"Android","chromedriverExecutable":"C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe","deviceName":"4d007af54ac04177","platformName":"Android","version":"6.0.1"},"appActivity":"com.google.android.apps.chrome.Main","appPackage":"com.android.chrome","browserName":"Android","chromedriverExecutable":"C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe","deviceName":"4d007af54ac04177","platformName":"Android","version":"6.0.1","deviceUDID":"4d007af54ac04177","platformVersion":"6.0.1","deviceScreenSize":"1080x1920","deviceModel":"SM-G900H","deviceManufacturer":"samsung"}
[HTTP] <-- POST /wd/hub/session 200 35735 ms - 978
[HTTP] --> POST /wd/hub/session/b284c843-d3e4-4d13-94aa-a9f752377fe8/timeouts {"type":"implicit","ms":10000}
[MJSONWP] Calling AppiumDriver.timeouts() with args: ["implicit",10000,"b284c843-d3e4-4d13-94aa-a9f752377fe8"]
[BaseDriver] Set implicit wait to 10000ms
[MJSONWP] Responding to client with driver.timeouts() result: null
[HTTP] <-- POST /wd/hub/session/b284c843-d3e4-4d13-94aa-a9f752377fe8/timeouts 200 5 ms - 76
[HTTP] --> POST /wd/hub/session/b284c843-d3e4-4d13-94aa-a9f752377fe8/url {"url":"https://us.justdial.com"}
[MJSONWP] Calling AppiumDriver.setUrl() with args: ["https://us.justdial.com","b284c843-d3e4-4d13-94aa-a9f752377fe8"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","am","start","-W","-a","android.intent.action.VIEW","-d","https://us.justdial.com","com.android.chrome"]
[ADB] Running 'C:\Users\vaibhavsi\AppData\Local\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","4d007af54ac04177","shell","am","start","-W","-a","android.intent.action.VIEW","-d","https://us.justdial.com","com.android.chrome"]
[ADB] Error: Error attempting to start URI. Original error: Error: Error executing adbExec. Original error: 'Command 'C\:\\Users\\vaibhavsi\\AppData\\Local\\Android\\android-sdk\\platform-tools\\adb.exe -P 5037 -s 4d007af54ac04177 shell am start -W -a android.intent.action.VIEW -d https\://us.justdial.com com.android.chrome' timed out after 20000ms'; Stderr: ''; Code: 'null'
at Object.wrappedLogger.errorAndThrow (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:63:13)
at ADB.callee$0$0$ (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\apk-utils.js:47:9)
at tryCatch (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
Error: Error attempting to start URI. Original error: Error: Error executing adbExec. Original error: 'Command 'C\:\\Users\\vaibhavsi\\AppData\\Local\\Android\\android-sdk\\platform-tools\\adb.exe -P 5037 -s 4d007af54ac04177 shell am start -W -a android.intent.action.VIEW -d https\://us.justdial.com com.android.chrome' timed out after 20000ms'; Stderr: ''; Code: 'null'
at Object.wrappedLogger.errorAndThrow (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:63:13)
at ADB.callee$0$0$ (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\apk-utils.js:47:9)
at tryCatch (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
[MJSONWP] Encountered internal error running command: Error: Error attempting to start URI. Original error: Error: Error executing adbExec. Original error: 'Command 'C\:\\Users\\vaibhavsi\\AppData\\Local\\Android\\android-sdk\\platform-tools\\adb.exe -P 5037 -s 4d007af54ac04177 shell am start -W -a android.intent.action.VIEW -d https\://us.justdial.com com.android.chrome' timed out after 20000ms'; Stderr: ''; Code: 'null'
at Object.wrappedLogger.errorAndThrow (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:63:13)
at ADB.callee$0$0$ (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\apk-utils.js:47:9)
at tryCatch (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (C:\Users\vaibhavsi\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
[HTTP] <-- POST /wd/hub/session/b284c843-d3e4-4d13-94aa-a9f752377fe8/url 500 40572 ms - 553
Frequent Error:
An unknown server-side error occurred while processing the command. Original error: Error attempting to start URI. Original error: Error: Error executing adbExec. Original error: 'Command 'C\:\\Users\\vaibhavsi\\AppData\\Local\\Android\\android-sdk\\platform-tools\\adb.exe -P 5037 -s 4d007af54ac04177 shell am start -W -a android.intent.action.VIEW -d https\://us.justdial.com com.android.chrome' timed out after 20000ms'; Stderr: ''; Code: 'null' (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Please look into same.
Since you are trying to test web app in browser, why not to do it this way:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, MobileBrowserType.BROWSER);
// if chrome is installed, but not default one - use MobileBrowserType.CHROME
AppiumDriver<MobileElement> driver = new AndroidDriver<>(
new URL("http://127.0.0.1:4723/wd/hub"),
capabilities
);
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("https://us.justdial.com");
It works perfectly for me with Appium java client 5.0.4 / server 1.7.1
Removed "Unlock" and "Appium settings" apps from device - Appium installs those apps automatically.
Also, passed appium arguments in my scripts. Below are the changes:
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import io.appium.java_client.AppiumDriver;
public class Appium_device {
//String driverPath = "F:/ChromeDriver/chromedriver.exe";
AppiumDriver<?> driver;
#BeforeTest
public void Appium_device() throws MalformedURLException, Exception {
{
// APPLICATION_LOG.info("Initializing project properties");
DesiredCapabilities capabilities = new DesiredCapabilities();
// Set android deviceName desired capability. Set your device name.
// capabilities.setCapability("deviceName", "5203a1bbea4a8385");
// capabilities.setCapability("deviceName", "4100df0accbd9f00");
// capabilities.setCapability("deviceName", "0123456789ABCDEF");
capabilities.setCapability("deviceName", "4d007af54ac04177");
// Set BROWSER_NAME desired capability. It's Android in our case here.
capabilities.setCapability(CapabilityType.BROWSER_NAME, "Android");
// capabilities.setCapability("browsername", "chrome");
// capabilities.setCapability("chromedriverExecutable", "C:/Users/vaibhavsi/Downloads/chromedriver_win32/chromedriver.exe");
// Set android VERSION desired capability. Set your mobile device's OS version.
// capabilities.setCapability(CapabilityType.VERSION, "4.2.2");
// capabilities.setCapability(CapabilityType.VERSION, "6.0.1");
capabilities.setCapability(CapabilityType.VERSION, "6.0.1");
// Set android platformName desired capability. It's Android in our case here.
capabilities.setCapability("platformName", "Android");
// Set android appPackage desired capability. It is
// com.android.calculator2 for calculator application.
// Set your application's appPackage if you are using any other app.
// capabilities.setCapability("appPackage", "org.mozilla.firefox");
capabilities.setCapability("appPackage", "com.android.chrome");
// Set android appActivity desired capability. It is
// com.android.calculator2.Calculator for calculator application.
// Set your application's appPackage if you are using any other app.
capabilities.setCapability("appActivity", "com.google.android.apps.chrome.Main");
// capability.setCapability("binary", "C:\Program Files\Google\Chrome\Application");
// Created object of RemoteWebDriver will all set capabilities.
// Set appium server address and port number in URL string.
// It will launch calculator app in android device.
// webdriver.Chrome(executable_path='C:\Users\Ganeshkumarg\Downloads\chromedriver_win32\chromedriver.exe');
// RemoteWebDriver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
// webDriver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
// capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
// capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, MobileBrowserType.BROWSER);
driver = new AppiumDriver<WebElement>(new URL("http://127.0.0.1:4723/wd/hub"),capabilities);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
}
#Test
public void launch() throws Exception {
try {
//driver.get("https://us.justdial.com");
driver.navigate().to("https://us.justdial.com");
System.out.println("site hit");
}
catch (Exception e) {
System.out.println("site not accessed");
throw (e);
// TODO: handle exception
}
}}
Thanks a ton to all for your helpful suggestions.