So there is a website in which when we enter a character in the 'username' place holder, a captacha appears which I want to use it in my app.
I tried using selenium's ChromeDriver but it gave me the follwing error: "Unable to find a free port". Is there way to change the port for ChromeDriver?
Then I thought I could do the same in JS and call it form Java using Rhino. But I could not find decent tutorial for JS web driver(for the task which I want to perform) or may be I missed out.
MainActivity.java:
@Override
protected void onResume(){
super.onResume();
new MyBackgroundDriver().execute("https://www.google.com/");//for test lets consider google.com
}
class MyBackgroundDriver extends AsyncTask<String, Void, Void> {
@Override
protected Void doInBackground(String... url) {
WebDriver driver=new ChromeDriver();
driver.get(url[0]);
driver.quit();
return null;
}
}
app/build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
.....
}
}
.....
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'org.seleniumhq.selenium:selenium-java:2.46.0'
implementation 'junit:junit:4.12'
//implementation 'io.appium:java-client:3.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Please help me out with this error or provide a solution for getting the generated captcha(without using WebView as I want the UI to be different). So even if there is a way to somehow change the UI(may be by hiding webview or running it in background), you are most welcomed.