@James_Kim,
Did you get a chance to run couple of operations once the browser is opened. Why i am asking is, Appium just launches the browser(in fact it is not launching Facebook page as i intended) and in fraction of a second, it closes the browser and coming to Home screen.
As per Appium log also i am thinking they are expecting Chrome browser to be run on emulator. Please find Appium log or let me know if i am missing something or my configurations are wrong.
> info: --> POST /wd/hub/session {"desiredCapabilities":{"browserName":"BROWSER","platformName":"Android","deviceName":"Testing","platform":"ANDROID"}}
> info: Client User-Agent string: Apache-HttpClient/4.3.4 (java 1.5)
> info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : platform
> info: Set mode: Proxying straight through to Chromedriver
> info: [debug] Looks like we want chrome on android
> info: [debug] Creating new appium session 16e85747-74fc-45d4-80ad-e2e7d77c480c
> info: [debug] Using fast reset? true
> info: [debug] Preparing device for session
> info: [debug] Not checking whether app is present since we are assuming it's already on the device
> info: [debug] Checking whether adb is present
> info: [debug] Using adb from D:\UD\sdk\tools\adb.exe
> info: Retrieving device
> info: [debug] Trying to find a connected android device
> info: [debug] Getting connected devices...
> info: [debug] executing cmd: D:\UD\sdk\tools\adb.exe devices
> info: [debug] 1 device(s) connected
> info: Found device emulator-5554
> info: [debug] Setting device id to emulator-5554
> info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
> info: [debug] executing cmd: D:\UD\sdk\tools\adb.exe -s emulator-5554 wait-for-device
> info: [debug] executing cmd: D:\UD\sdk\tools\adb.exe -s emulator-5554 shell "echo 'ready'"
> info: [debug] Starting logcat capture
> info: [debug] Pushing unlock helper app to device...
> info: [debug] executing cmd: D:\UD\sdk\tools\adb.exe -s emulator-5554 install "D:\softies\Programs\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
> info: [debug] executing cmd: D:\UD\sdk\tools\adb.exe -s emulator-5554 shell "dumpsys window"
> info: [debug] Screen already unlocked, continuing.
> info: [debug] Forwarding system:4724 to device:4724
> info: [debug] executing cmd: D:\UD\sdk\tools\adb.exe -s emulator-5554 forward tcp:4724 tcp:4724
> info: [debug] Pushing appium bootstrap to device...
> info: [debug] executing cmd: D:\UD\sdk\tools\adb.exe -s emulator-5554 push "D:\\softies\\Programs\\Appium\\node_modules\\appium\\build\\android_bootstrap\\AppiumBootstrap.jar" /data/local/tmp/
> info: Starting App
> info: [debug] Attempting to kill all 'uiautomator' processes
> info: [debug] Getting all processes with 'uiautomator'
> info: [debug] executing cmd: D:\UD\sdk\tools\adb.exe -s emulator-5554 shell "ps 'uiautomator'"
> info: [debug] Attempting to kill process 2065
> info: [debug] executing cmd: D:\UD\sdk\tools\adb.exe -s emulator-5554 shell "kill 2065"
> info: [debug] Running bootstrap
> info: [debug] spawning: D:\UD\sdk\tools\adb.exe -s emulator-5554 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap
> info: [debug] UiAutomator exited
> info: [debug] executing cmd: D:\UD\sdk\tools\adb.exe -s emulator-5554 shell "echo 'ping'"
> info: [debug] Attempting to uninstall app
> error: UiAutomator quit before it successfully launched
> info: [debug] Not uninstalling app since server not started with --full-reset
> info: [debug] Cleaning up android objects
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
> info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
> info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
> info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
> info: [debug] [BOOTSTRAP] [debug] Loading json...
> info: [debug] [BOOTSTRAP] [debug] json loading complete.
> info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
> info: [debug] Pushing command to appium work queue: ["getDataDir",{}]
> info: [debug] [BOOTSTRAP] [debug] Client connected
> info: [debug] dataDir set to: /data
> info: [debug] Creating Chrome session
> info: [debug] Set chromedriver binary as: D:\softies\Programs\Appium\node_modules\appium\build\chromedriver\windows\chromedriver.exe
> info: [debug] Ensuring Chromedriver exists
> info: [debug] Killing any old chromedrivers, running: FOR /F "usebackq tokens=5" %a in (`netstat -nao ^| findstr /R /C:"9515 "`) do (FOR /F "usebackq" %b in (`TASKLIST /FI "PID eq %a" ^| findstr /I chromedriver.exe`) do (IF NOT %b=="" TASKKILL /F /PID %b))
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"getDataDir","params":{}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"\/data"}
> info: [debug] No old chromedrivers seemed to exist
> info: [debug] Spawning chromedriver with: D:\softies\Programs\Appium\node_modules\appium\build\chromedriver\windows\chromedriver.exe
> info: [debug] [CHROMEDRIVER] Starting ChromeDriver (v2.10.267521) on port 9515
> Only local connections are allowed.
> info: [debug] Making http request with opts: {"url":"http://127.0.0.1:9515/wd/hub/session","method":"POST","json":{"sessionId":null,"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.android.browser","androidActivity":"com.android.browser.BrowserActivity","androidDeviceSerial":"emulator-5554"}}}}
> info: [debug] [CHROMEDRIVER STDERR] [0.008][SEVERE]: Could not bind socket to 127.0.0.1:9515
> info: [debug] [CHROMEDRIVER] Port not available. Exiting...
> info: [debug] Chromedriver exited with code 1
> info: [debug] Getting connected devices...
> info: [debug] executing cmd: D:\UD\sdk\tools\adb.exe -s emulator-5554 devices
> info: [debug] 1 device(s) connected
> info: [debug] executing cmd: D:\UD\sdk\tools\adb.exe -s emulator-5554 shell "am force-stop com.android.browser"
> info: [debug] Stopping logcat capture
> info: [debug] Logcat terminated with code null, signal SIGTERM
> info: [debug] Cleaning up appium session
> error: Chromedriver create session did not work. Status was 200 and body was {"sessionId":"7fde11aa9f9d0473627c765af031ad39","status":13,"value":{"message":"unknown error: Chrome version must be >= 33.0.1750.0\n (Driver info: chromedriver=2.10.267521,platform=Windows NT 6.1 SP1 x86)"}}
> info: [debug] Cleaning up appium session
> error: Failed to start an Appium session, err was: Error: Did not get session redirect from Chromedriver
> info: [debug] Error: Did not get session redirect from Chromedriver
> at null.<anonymous> (D:\softies\Programs\Appium\node_modules\appium\lib\devices\android\chromedriver.js:222:12)
> at Request._callback (D:\softies\Programs\Appium\node_modules\appium\lib\devices\common.js:121:5)
> at Request.self.callback (D:\softies\Programs\Appium\node_modules\appium\node_modules\request\request.js:121:22)
> at Request.EventEmitter.emit (events.js:98:17)
> at Request.<anonymous> (D:\softies\Programs\Appium\node_modules\appium\node_modules\request\request.js:985:14)
> at Request.EventEmitter.emit (events.js:117:20)
> at IncomingMessage.<anonymous> (D:\softies\Programs\Appium\node_modules\appium\node_modules\request\request.js:936:12)
> at IncomingMessage.EventEmitter.emit (events.js:117:20)
> at _stream_readable.js:920:16
> at process._tickDomainCallback (node.js:459:13)
> info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Did not get session redirect from Chromedriver)","origValue":"Did not get session redirect from Chromedriver"},"sessionId":null}
> info: <-- POST /wd/hub/session 500 14972.154 ms - 214
Following is the code which i am trying to run:
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import java.io.File;
import java.net.URL;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.*;
public class LaunchMobileBrowser
{
private AndroidDriver driver;
@BeforeTest
public void setup() throws Exception
{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,"Testing");
capabilities.setCapability(MobileCapabilityType.PLATFORM, "ANDROID");
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "BROWSER");
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}
@Test
public void launchBrowser()
{
driver.get("http://www.facebook.com");
}
}