Enter URL in mobile web browser

I started using Appium to automate a particular website. I was able to perform the automation on the Android Emulator but when i try to run the same code on my android phone, it opens up the android browser but does not navigate to the url specified.

The code i am using is this.

public void setUp()
new DesiredCapabilities();
DesiredCapabilities capabilities= DesiredCapabilities.android();

capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "Browser");   
capabilities.setCapability(MobileCapabilityType.PLATFORM, "Android");
    driver = new RemoteWebDriver(new URL(the url of appium), capabilities);
    driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
catch(Exception e) 
    System.out.println("Here catch");

the error appium gives is this

debug: [CHROMEDRIVER] Starting ChromeDriver (v2.3) on port 9515
debug: Making http request with opts: {“url”:“chrome driver url”,“method”:“POST”,“json”:{“sessionId”:null,“desiredCapabilities”:{“chromeOptions”:{“androidPackage”:“com.android.browser”,“androidActivity”:“com.android.browser.BrowserActivity”,“androidDeviceSerial”:“0123456789ABCDEF”}}}}
error: Chromedriver create session did not work. Status was 200 and body was {“sessionId”:“ed984e72b4fbb97da4b49d10c74d4c98”,“status”:100,“value”:{“message”:“chrome not reachable\n (Driver info: chromedriver=2.3,platform=Windows NT 6.1 SP1 x86_64)”}}
info: ← POST /wd/hub/session 500 36383.128 ms - 214
debug: Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Did not get session redirect from Chromedriver
debug: Error: Did not get session redirect from Chromedriver
at null. (C:\Development\Appium\node_modules\appium\lib\devices\android\chromedriver.js:203:12)
at Request._callback (C:\Development\Appium\node_modules\appium\lib\devices\common.js:102:5)
at Request.self.callback (C:\Development\Appium\node_modules\appium\node_modules\request\request.js:121:22)
at Request.EventEmitter.emit (events.js:98:17)
at Request. (C:\Development\Appium\node_modules\appium\node_modules\request\request.js:985:14)
at Request.EventEmitter.emit (events.js:117:20)
at IncomingMessage. (C:\Development\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)
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}

I do not understand why it wants to check for Chrome. Any help would be appreciated.

Thanks in Advance.

U r using wrong methods, Please refer below sample project on github.


Priyank Shah

Thanks i will give this a try,
but could you tell me why my code, which works perfectly on the android emulator by navigating to the url and all the defined functions and methods opens up the browser on my mobile and stops there ?