0

I'm using Android studio to build a projects My Question is there any way to setup Selendroid in Android studio? Please Teach me step by step.

I already added this to my Gradle

In my Gradle Project:

 dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        testCompile 'junit:junit:4.12'
        compile 'com.android.support:appcompat-v7:23.1.0'
        compile 'org.seleniumhq.selenium:selenium-java:2.48.2'
    }buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
}

In my Module app:

dependencies {
    classpath 'com.android.tools.build:gradle:1.3.0'
    classpath 'org.seleniumhq.selenium:selenium-java:2.47.1'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

My Main Activity

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    SelendroidCapabilities capa = new SelendroidCapabilities("io.selendroid.testapp:0.17.0");

    WebDriver driver = new WebDriver(capa);
    WebElement inputField = driver.findElement(By.id("my_text_field"));
    Assert.assertEquals("true", inputField.getAttribute("enabled"));
    inputField.sendKeys("Selendroid");
    Assert.assertEquals("Selendroid", inputField.getText());
    driver.quit();
}

My Error is SelendroidCapabilities capa = new SelendroidCapabilities("io.selendroid.testapp:0.17.0"); Error:(5, 1) error: package io.selendroid.client does not exist

Hiro Shaw
  • 385
  • 3
  • 18
Jude Bautista
  • 160
  • 1
  • 16

2 Answers2

1

You should write anything in MainActivity instead create a new Java Class ins scr-> Main -> add your Test case code there.

then go to build variant -> select Unit Tests and run the Test case

anuja jain
  • 1,367
  • 13
  • 19
0

Try to add this to your project!(eclipse: Right click to your project -> Build Path -> Add external Archives... -> Choose the downloaded .jar file.) Hope this help!

Huy Hóm Hỉnh
  • 597
  • 7
  • 18