Android selenium-htmlunit-driver

164 views
Skip to first unread message

sengsationa1

unread,
Dec 19, 2021, 10:48:50 PM12/19/21
to Selenium Users
I'm lost in the sheer vastness of the source code Selenium space.

When I put `implementation 'org.seleniumhq.selenium:selenium-htmlunit-driver:2.52.0'` into the app build.gradle in an Android project, I get the following error:

java.lang.NoSuchFieldError: No static field INSTANCE of type Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; in class Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; or its superclasses (declaration of 'org.apache.http.conn.ssl.AllowAllHostnameVerifier' appears in /system/framework/framework.jar!classes4.dex)

I'm trying to understand what happened, from a code forking perspective, and if there's a way around this.  The above seems to indicate that if I pull from [https://repo.maven.apache.org/maven2/org/seleniumhq/selenium/selenium-htmlunit-driver/] (which is where the Android Studio pulls from), the latest code is from 2016, and it's an old version (2.25.0).  It appears that Android system framework is looking for AllowAllHostnameVerifier, but it's not there?

So I found this, from Stackoverflow: https://stackoverflow.com/questions/69523686/android-studio-how-can-i-fill-in-a-html-form-and-click-the-submit-button-with-se which is an unanswered question.  That leads to a discussion that I don't understand ( lost in the sheer vastness of the source code Selenium space) and this: https://github.com/HtmlUnit/htmlunit/issues/133

The good news is that user `rbri` has a recent comment on the github issue. I hope his idea is fruitful, but also thought that the users here might have found a work-around that they had yet to share with the world.

Krishnan Mahadevan

unread,
Dec 19, 2021, 10:56:06 PM12/19/21
to seleniu...@googlegroups.com
>>>>> java.lang.NoSuchFieldError: No static field INSTANCE of type Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; in class Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; or its superclasses (declaration of 'org.apache.http.conn.ssl.AllowAllHostnameVerifier' appears in /system/framework/framework.jar!classes4.dex)


This is Java’s way of telling you the following:

I am trying to refer to a field called INSTANCE that used to exist in the classpath when the class was compiled but now it seems to be missing. 

Root cause: You have a classpath conflict. You would need to do the following :

1. Find out in what version of apache used to have this and add an explicit dependency to it and 
2. You may also need to add exclusions to the other dependencies in your build file to ensure that they dont override your explicit dependency and bring in a newer version. 


Refer to this SO post as well https://stackoverflow.com/a/60451867


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

From: 'sengsationa1' via Selenium Users <seleniu...@googlegroups.com>
Sent: Monday, December 20, 2021 3:05:58 AM
To: Selenium Users <seleniu...@googlegroups.com>
Subject: [selenium-users] Android selenium-htmlunit-driver
 
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/b42359cc-ce4a-43cb-9011-d794261d2044n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages