mlz7
mlz7

Reputation: 2157

How do I add Selendroid to android studio for web scraping?

Please see edits below before answering!

I am trying to set up dynamic web scraping with Selenium, however, I can't seem to find the necessary gradle dependencies/lib files to add to my project. I looked at Selendroid/Selenium's website and was unable to find the necessary configuration information. I am assuming that I need the webdriver as I am going to be scraping web data. As a side note, I have decided on using Selendroid after finding HtmlUnit incompatible with Android, and after finding no viable alternatives. All help is appreciated.

(Other questions addressing this problem remain unanswered)

Edit: so using Exeon's suggestion, I found the following dependency for Selendroid:

compile 'io.selendroid:selendroid-client:0.16.0'
However, upon running my application, I get the following error (repeated around 10 times):

Warning:Dependency org.apache.httpcomponents:httpclient:4.3.6 is ignored for debug as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages

Note, I did try using the following as well:

compile 'org.testcontainers:selenium:0.9.7'

but I was met with the same error...

Upvotes: 15

Views: 1651

Answers (2)

weletonne
weletonne

Reputation: 489

For your error regarding the dependency issue you could try to exclude the httpclient from the selendroid library. I tried it too but I got other dependency issues, but you could give it a try :

compile('io.selendroid:selendroid-client:0.16.0') {
        exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
    }

After that I was able to import like that:

import io.selendroid.client.*;

and use the WebDriver.

Upvotes: -1

kandi
kandi

Reputation: 1118

Something like this:

 buildscript {
     repositories {
         mavenCentral()
     }
     dependencies {
         classpath 'org.seleniumhq.selenium:selenium-java:2.47.1'

         } 
 }

(adding maven repo using gradle)

Upvotes: -1

Related Questions