Android 4.3 Chrome

Hi,

I’ve created a test to open up Chrome and navigate to a website and attempt to login. However I’m having problems opening Chrome at all, Chrome opens up and then closes as soon as it enters my @Test. It returns the error code NoSuchElementException: no such element, which I think is understandable as the webpage I’m trying to open hasn’t opened before Chrome crashed?

I’m running Eclipse Luna, Appium 1.4.0.0 on a Samsung Galaxy Nexus (Android 4.3).

Any help would be appreciated, thanks alot!

package appium;
import java.io.File;
import java.net.URL;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
public class android 
{
	WebDriver driver;
@Before
public void setUp() throws Exception 
{
	System.out.println("execute Before");
	DesiredCapabilities capabilities = new DesiredCapabilities();
	capabilities.setCapability("BROWSER_NAME","Android");	
	capabilities.setCapability("VERSION","4.3");
	capabilities.setCapability("deviceName","0149BD330200800E");
	capabilities.setCapability("platformName","Android");
	capabilities.setCapability("appPackage","com.android.browser");
	capabilities.setCapability("app-activity", ".com.google.android.app.chrome.Mains");
	driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}
@Test
public void testCalc() throws Exception 
{
	System.out.println("execute Test");
	WebElement urlbar=driver.findElement(By.id("com.android.chrome:id/search_box_text"));
	urlbar.sendKeys("https://ourwebsite.co.uk/");
	WebElement username=driver.findElement(By.name("username"));
	username.sendKeys("superuser");
	WebElement password=driver.findElement(By.name("password"));
	password.sendKeys("Superuser_1");
	//WebElement okBtn = driver.findElement(By.name("submit"));
	//okBtn.click();
}
@After
public void teardown()
{
	driver.quit();
}
}

Please provide some logs.

1 Like

as sebv suggested, appium logs would definitely help.

Another suggestion would be to change browser name etc to point to Chrome and not the default android browser if you want to test chrome.

1 Like

Thanks for the help! changing to Chome and adding a driver.get has solved my problems :slight_smile: Thanks!