Url is not getting entered in chrome browser

Facing issue while launching chrome browser Appium. Chrome browser is getting opened multiple times(4 times) and closing even if a single @test method is present. After browser launch url is not getting entered.
Testing Environment: Nexus 5, Andriod 5.1.1, Chrome 54(latest), Appium latest (AppiumForWindows_1_4_16_1).

Selenium Code:

package com.cxm.testcases;
import java.net.MalformedURLException;
import java.net.URL;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import org.openqa.selenium.By;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.BrowserType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;

public class Appium
{

   @Test
   public void test1() throws MalformedURLException, InterruptedException{

          // Create object of  DesiredCapabilities class and specify android platform
          DesiredCapabilities capabilities=DesiredCapabilities.android();


          // set the capability to execute test in chrome browser
          capabilities.setCapability(MobileCapabilityType.BROWSER_NAME,BrowserType.CHROME);

          // set the capability to execute our test in Android Platform
          capabilities.setCapability(MobileCapabilityType.PLATFORM,Platform.ANDROID);

          // we need to define platform name
          capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME,"Android");
          capabilities.setCapability("appium-version", "1.4.16.1");

          // Set the device name as well (you can give any name)
          capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,"Nexus5");

          // set the android version as well 
          capabilities.setCapability(MobileCapabilityType.VERSION,"5.1.1");

          // Create object of URL class and specify the appium server address
          URL url= new URL("http://127.0.0.1:4723/wd/hub");
          

          // Create object of  AndroidDriver class and pass the url and capability that we created
          WebDriver driver = new AndroidDriver(url, capabilities);
          System.out.println("before entring url");

          // Open url
          driver.get("http://www.google.com");

          // print the title
          System.out.println("Title "+driver.getTitle());

          // enter username
          driver.findElement(By.name("email")).sendKeys("abc");

          // enter password
          driver.findElement(By.name("pass")).sendKeys("sel");

          // click on submit button
          driver.findElement(By.id("u_0_5")).click();

          // close the browser
          driver.quit();

   }

}

Console Error:
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: A new session could not be created. (Original error: session not created exception from unknown error: Runtime.executionContextCreated has invalid ‘context’: {“auxData”:{“frameId”:“1213.1”,“isDefault”:true},“id”:1,“name”:"",“origin”:"://"} (Session info: chrome=54.0.2840.85) (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 6.1 SP1 x86))) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 0 milliseconds Build info: version: ‘3.0.1’, revision: ‘1969d75’, time: ‘2016-10-18 09:49:13 -0700’ System info: host: ‘CSSLSYSTEM-283’, ip: ‘172.30.5.86’, os.name: ‘Windows 7’, os.arch: ‘x86’, os.version: ‘6.1’, java.version: ‘1.8.0_60’ Driver info: driver.version: AndroidDriver at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:161) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:64) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:180) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:128) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:155) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:109) at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:39) at com.cxm.testcases.Appium.test1(Appium.java:45) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80) at org.testng.internal.Invoker.invokeMethod(Invoker.java:714) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111) at org.testng.TestRunner.privateRun(TestRunner.java:767) at org.testng.TestRunner.run(TestRunner.java:617) at org.testng.SuiteRunner.runTest(SuiteRunner.java:334) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291) at org.testng.SuiteRunner.run(SuiteRunner.java:240) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1198) at org.testng.TestNG.runSuitesLocally(TestNG.java:1123) at org.testng.TestNG.run(TestNG.java:1031) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:126) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:152) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:57)

@arun_nair Hi, Did you get this sorted it out? . if yes please help me with the resolution.

Thanks

Hello, I am facing this issue as well. Many posts suggested that, chrome driver has to be upgraded, but the error still exists.
This is my sample code-very simple actually :slight_smile:
DesiredCapabilities cap = new DesiredCapabilities();

	cap.setCapability("deviceName","Moto G (4)");
	cap.setCapability("platformName","Android");
	cap.setCapability("platformVersion","7.0");
	
	
	//browser details
	cap.setCapability(CapabilityType.BROWSER_NAME,"Chrome");
			
	//appium server details
	AndroidDriver driver= new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), cap);
	Thread.sleep(2000);
	
	driver.get("https://www.greentrends.in/");
	
	driver.close(); 

}

I use Android 7.0, Appium version 1.4.16 and Eclipse Luna
Windows 7 32 bit machine ,Java language

@willosser do you have any ideas about this?

We do not use Appium’s ChromeDriver. We needed the browser before it was available/functional. We wrote our own utilities to launch and interact with browsers. Sorry I can’t be of much help here.

Actually @willosser, you did help. Thanks! The problem was that the chrome version 56 is handled by chrome driver v2.28 , so i just had to upgrade them. Also you mention Appium’s chrome driver, which lead me to upgrade the chrome driver in appium/node_modules as well. So now the problem is resolved

@arun_nair @sivashankar.st47 did you guys get this resolved? if not I can try to help :slight_smile:

1 Like

Hi @Manasa_Kashyap still im with same error.Please help

Hello, could you specify the exact problem so i can help you ?

HI @Manasa_Kashyap

I’m just begnier for appium.

Below is my code to invoke chrome browser in andriod device/emulator and launch a website. When i run this from robot framework, chrome browser launched with data:, as in the address bar and the browser gets closed and relaunced again and again. Can you please help me to overcome this issue

Open Application http://localhost:4723/wd/hub platformName=Android platformVersion=6.0.0 deviceName=192.168.188.101:5555 appPackage=com.android.chrome appActivity=org.chromium.chrome.browser.ChromeTabbedActivity
Close All Applications

Thanks,
Siva

Hello,
Let me see if i can help
The first thing you have to do is ‘check for the chrome version in your device’ if the version is higher than 55 you should have chromedriver v2.28 - (https://chromedriver.storage.googleapis.com/2.28/notes.txt )

If your version is higher then do the following

  1. If you are working on a Maven project, go to pom and update the versions of selenium-java, selenium-chrome driver, and other selenium related dependencies to 3.3.1 and save the pom.xml. This automatically builds the workspace with mentioned versions

  2. Go to Appium chromedriver i.e \Appium\node_modules\appium\node_modules\appium-chromedriver- Location where you have saved the Appium and manually downlaod Chromedriver v2.28-https://chromedriver.storage.googleapis.com/index.html?path=2.28/ and replace it in the above folder

You should be good to run the test now. If you face any other issues, do let me know

Br, Manasa

Hi Manasa,

I just wanted to know when using a maven project how to you run the test, when i select run its says run configurations.

Also what dependencies did you use in your pom file.

@Manasa_Kashyap I have upgraded chromedriver to 2.29 and selenium jars to 3.3.1 still I’m getting the same issue

Hello, Usually I run it as a Java or run it from TestNG. I think as a first step you should go through some Maven tutorials online. Also here is my pom.xml

4.0.0
WebBased
EventLinked
0.0.1-SNAPSHOT

    <!-- Core selenium jars -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.3.1</version>
    </dependency>

    <!-- Firefox driver jar -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-firefox-driver</artifactId>
        <version>3.3.1</version>
    </dependency>

    <!-- Selenium IE driver -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-ie-driver</artifactId>
        <version>3.3.1</version>
    </dependency>

    <!-- Selenium Chrome driver -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-chrome-driver</artifactId>
        <version>3.3.1</version>
    </dependency>

    <!-- TestNG dependency configuration -->
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.8</version>
        <scope>test</scope>
    </dependency>

    <!-- XML apis -->
    <dependency>
        <groupId>xml-apis</groupId>
        <artifactId>xml-apis</artifactId>
        <version>1.4.01</version>
    </dependency>

    <!-- My SQL java connector -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.31</version>
    </dependency>

    <!-- POI for excel -->
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>3.10-FINAL</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>3.10-FINAL</version>
        <type>jar</type>
    </dependency>

    <!-- DOM api -->
    <dependency>
        <groupId>org.axsl.org.w3c.dom.svg</groupId>
        <artifactId>svg-dom-java</artifactId>
        <version>1.1</version>
    </dependency>
io.appium java-client 4.1.2 com.google.guava guava 21.0
  </dependencies>  

Hello, Can you please give me more information and logs about this?

Issue is resolved now. Instead of upgrading chrome driver I have downgraded it.

Thanks for the support!