Running selenium tests in android browser in a emulator

908 views
Skip to first unread message

praneeth kumar

unread,
Mar 5, 2014, 3:34:36 PM3/5/14
to selen...@googlegroups.com
Hi

I have few selenium test which needs to be tested on android emulator.I have used maven to write these tests and did the below configuration to run the tests on android emulator.

public void start selenium server {
SelendroidConfiguration config = new SelendroidConfiguration();
config.addSupportedApp("src/main/resources/selendroid-test-app-0.8.0.apk");
selendroidServer = new SelendroidLauncher(config);
selendroidServer.lauchSelendroid();
SelendroidCapabilities caps = new SelendroidCapabilities("io.selendroid.testapp:0.8.0"); driver = new SelendroidDriver(caps);
}


and also included the dependencies in pom as

<dependency> <groupId>io.selendroid</groupId> <version>0.8.0</version> <artifactId>selendroid-standalone</artifactId> </dependency> <dependency> <groupId>io.selendroid</groupId> <version>0.8.0</version> <artifactId>selendroid-client</artifactId> </dependency>


Do I need to do any additional configuration to run the tests in the android browser.??

Thanks
Praneeth

Luke Inman-Semerau

unread,
Mar 5, 2014, 3:39:06 PM3/5/14
to selen...@googlegroups.com
It's much simpler to run against the "browser"

http://selendroid.io/mobileWeb.html

praneeth kumar

unread,
Mar 5, 2014, 3:53:04 PM3/5/14
to selen...@googlegroups.com
Hi luke

many thanks for your reply.. so for my tests to run on the browser is it enough if i just include the below method in my code.
 public void startSelendroidServer() throws Exception {
    if (selendroidServer != null) {
      selendroidServer.stopSelendroid();
    }
    SelendroidConfiguration config = new SelendroidConfiguration();

    selendroidServer = new SelendroidLauncher(config);
    selendroidServer.lauchSelendroid();

    DesiredCapabilities caps = SelendroidCapabilities.android();

    driver = new SelendroidDriver(caps);

Yan Lincle

unread,
Mar 5, 2014, 8:59:04 PM3/5/14
to selen...@googlegroups.com
I really think it is enough for Mobile web.because for mobile web,not need to set the app.below is the code phrase from the https://github.com/selendroid/demoproject-selendroid/blob/master/src/main/java/io/selendroid/demo/mobileweb/MobileWebTest.java ,so your coding is right.

Yan Lincle

unread,
Mar 5, 2014, 9:01:06 PM3/5/14
to selen...@googlegroups.com
anyway,https://github.com/selendroid/demoproject-selendroid/blob/master/src/main/java/io/selendroid/demo/mobileweb/MobileWebTest.java here,is a good place to solve most of your problems,here is wrote by DominikDary  who writed down the structure of Selendroid,including all kinds of examples.hope it will help you

praneeth kumar

unread,
Mar 6, 2014, 5:48:34 AM3/6/14
to
Hi yan ,

I have ran the test successfully on my mobile. Can you please let me know what configurations do i need to make inorder to run the tests on an emulator.

Thanks
Praneeth

praneeth kumar

unread,
Mar 6, 2014, 7:35:50 AM3/6/14
to selen...@googlegroups.com
Hi all,

The error I am getting when i run the test is


INFO: executing command: C:\adt-bundle-windows-x86_64-20131030\sdk\build-tools\android-4.4\aapt.exe remove C:\Users\CAMPK023\AppData\Local\Temp\android-driver5204.apk META-INF/ANDROIDD.RSA

java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.getUserDirectory()Ljava/io/File;
    at io.selendroid.builder.SelendroidServerBuilder.androidDebugKeystore(SelendroidServerBuilder.java:284)
    at io.selendroid.builder.SelendroidServerBuilder.signTestServer(SelendroidServerBuilder.java:228)
    at io.selendroid.builder.SelendroidServerBuilder.resignApp(SelendroidServerBuilder.java:134)
    at io.selendroid.server.model.SelendroidStandaloneDriver.initApplicationsUnderTest(SelendroidStandaloneDriver.java:156)
    at io.selendroid.server.model.SelendroidStandaloneDriver.<init>(SelendroidStandaloneDriver.java:93)
    at io.selendroid.server.SelendroidStandaloneServer.initializeSelendroidServer(SelendroidStandaloneServer.java:91)
    at io.selendroid.server.SelendroidStandaloneServer.<init>(SelendroidStandaloneServer.java:65)
    at io.selendroid.SelendroidLauncher.lauchServer(SelendroidLauncher.java:67)
    at io.selendroid.SelendroidLauncher.lauchSelendroid(SelendroidLauncher.java:90)
    at pages.AboutDirectDebitsPage.startSelendroidServer(AboutDirectDebitsPage.java:29)
    at stepdefinitions.DirectDebitStepDefs.I_am_in_the_business_rates_direct_debits_home_page(DirectDebitStepDefs.java:30)
    at ✽.Given I am in the business rates direct debits home page(BusinessRatesDirectDebitSetup.feature:8)


Any idea how can I solve

Thanks
praneeth


On Wednesday, March 5, 2014 8:34:36 PM UTC, praneeth kumar wrote:

praneeth kumar

unread,
Mar 6, 2014, 8:44:05 AM3/6/14
to
The point where I am getting the error is
 
private File androidDebugKeystore() {
      if (serverConfiguration == null || serverConfiguration.getKeystore() == null) {
        return new File(FileUtils.getUserDirectory(), File.separatorChar + ".android"
            + File.separatorChar + "debug.keystore");
      } else {
          return new File(serverConfiguration.getKeystore()); 
      }
  }

 
Thanks
Praneeth

Yan Lincle

unread,
Mar 7, 2014, 3:46:53 AM3/7/14
to selen...@googlegroups.com
hi,praneeth kumar:
    if you wanna run the tests on an emulator,you need change your code like this:
   
SelendroidConfiguration config=SelendroidCapabilities.emulator( ... )


On Thu, Mar 6, 2014 at 6:41 PM, praneeth kumar <citrixitc...@gmail.com> wrote:
Hi yan ,

I have ran the test successfully on my mobile. Can you please let me know what configurations do i need to make inorder to run the tests on an emulator.

Thanks
Praneeth


On Wednesday, March 5, 2014 8:34:36 PM UTC, praneeth kumar wrote:

--
You received this message because you are subscribed to the Google Groups "selendroid" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selendroid+...@googlegroups.com.
Visit this group at http://groups.google.com/group/selendroid.
To view this discussion on the web, visit https://groups.google.com/d/msgid/selendroid/b015869c-370a-4240-9222-a24554868efb%40googlegroups.com.

praneeth kumar

unread,
Mar 7, 2014, 3:53:50 AM3/7/14
to
Hi yan ,

thanks for reply..The results when i run the server is

{"status":0,"value":{"supportedApps":
[{"appId":"io.selendroid.androiddriver:0.8.0","mainActivity":"io.selendroid.androiddriver.WebViewActivity","basePackage":"io.selendroid.androiddriver"}],"os":
{"arch":"amd64","name":"Windows 8","version":"6.2"},"build":{"browserName":"selendroid","version":"0.8.0"},"supportedDevices":
[{"screenSize":"768x1280","emulator":true,"androidTarget":"ANDROID19","avdName":"test"}]}}.


what is the value i need to include in emulator(????? )If i want to run tests ina emulator browser
SelendroidConfiguration config=SelendroidCapabilities.emulator(????? )



Dominik Dary

unread,
Mar 10, 2014, 3:38:40 AM3/10/14
to selen...@googlegroups.com
You have not registered any app, so therefore i guess you want to test the mobile web.
Have a look at our dcou to find the details about how you can do it:
http://selendroid.io/mobileWeb.html

-Dominik
Reply all
Reply to author
Forward
0 new messages