jeudi 29 janvier 2015

Automating the mobile browser on Android with Appium

I am writing a simple test to navigate to a website on a mobile browser, mostly to get an understanding of Appium. I am using an android emulator. My code looks like this:



import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileBrowserType;
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import java.net.URL;

public class DLMobileTest
{
private WebDriver driver;

@Test
public void loadingSinglePageTest() throws Exception{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "5.0.1");
capabilities.setCapability("deviceName", "Nexus 7");
capabilities.setCapability("browserName", MobileBrowserType.BROWSER);
driver = new AndroidDriver(new URL("http://ift.tt/1eWSHgW"), capabilities);
driver.get("http://en.wikipedia.org");
driver.quit();
}
}


When I run the test, the emulator's browser briefly starts, but before it navigates to the Wikipedia site I'm aiming for, I get this:



org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Did not get session redirect from Chromedriver) (WARNING: The server did not provide any stacktrace information)


I'm not sure what my mistake is here. Any help is appreciated.


Aucun commentaire:

Enregistrer un commentaire