selenium not found

493 views
Skip to first unread message

Caleb Chang

unread,
Mar 19, 2021, 5:35:41 PM3/19/21
to OWASP ZAP User Group
I watched the single sign on juice shop authentication video, and I am trying to follow along. I created a script using graal engine and copied the first line of the script from minute 2:40 of that video:

let By = Java.type('org.openqa.selenium.By')

When I run this, I get the following error: 

org.graalvm.polyglot.PolyglotException: TypeError: Access to host class org.openqa.selenium.By is not allowed or does not exist.

Any idea why I am unable to find the selenium Class? I have the selenium add-on. I am using java version 15.

kingthorin+owaspzap

unread,
Mar 19, 2021, 5:43:16 PM3/19/21
to OWASP ZAP User Group
Did you install the selenium add-on?

zap-screenshot-browse-addons[1].png

Caleb Chang

unread,
Mar 19, 2021, 5:49:30 PM3/19/21
to zaprox...@googlegroups.com
Wow, you guys respond fast!

Yes, I have the selenium add-on installed.
image.png

--
You received this message because you are subscribed to a topic in the Google Groups "OWASP ZAP User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/zaproxy-users/QSMdX25xoGA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to zaproxy-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/zaproxy-users/0f064fce-7804-4bce-aec6-02065ac190een%40googlegroups.com.

Caleb Chang

unread,
Mar 19, 2021, 5:52:39 PM3/19/21
to zaprox...@googlegroups.com
By the way, it is possible that I am using java version 8. I have both java 15 and 8 installed

Caleb Chang

unread,
Mar 22, 2021, 10:52:14 AM3/22/21
to OWASP ZAP User Group
Is this happening to anyone else? I even uninstalled and reinstalled zap, but I still get the same issue

thc...@gmail.com

unread,
Mar 22, 2021, 11:01:30 AM3/22/21
to zaprox...@googlegroups.com
That's caused by an issue in the GraalVM JavaScript add-on.

If you are still using Java 8 you can select the Nashorn engine instead
(syntax is a little different though).

Best regards.
>>>> <https://groups.google.com/d/msgid/zaproxy-users/0f064fce-7804-4bce-aec6-02065ac190een%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>
>

Caleb Chang

unread,
Mar 22, 2021, 2:52:24 PM3/22/21
to OWASP ZAP User Group
thx! Switching to nashorn engine worked!

Volodymyr Molodets

unread,
Jan 4, 2023, 6:39:18 AM1/4/23
to OWASP ZAP User Group
The issue still exists and I've been able to reproduce this on;
- W10 machine
- Java 8 Update 351 (64-bit) (8.0.3510.10)
- OWASP ZAP 2.11.1.

As soon as I try to upgrade OWASP ZAP from 2.11.1 to the latest version 2.12.0, the installation asks me to install the proper version of JRE SDK

Screenshot 2023-01-04 125007.png
Once installed, the issue shows up.

Simon Bennetts

unread,
Jan 4, 2023, 6:44:45 AM1/4/23
to OWASP ZAP User Group
You say you have "Java 8 Update 351 (64-bit) (8.0.3510.10)"
But as per the release notes, ZAP 2.12.0 requires a minimum of Java 11.
So you need to install Java 11 or greater.

Cheers,

Simon

Volodymyr Molodets

unread,
Jan 4, 2023, 7:09:59 AM1/4/23
to OWASP ZAP User Group
Yes, that's what I did next.

But after that I am unable to run even builtin standalone scripts on ZAP 2.12.0 and getting the same exception as the OP. PFB.Screenshot 2023-01-04 140620.png

Here is the exception:

org.graalvm.polyglot.PolyglotException: TypeError: Access to host class org.openqa.selenium.By is not allowed or does not exist.org.graalvm.polyglot.PolyglotException: TypeError: Access to host class org.openqa.selenium.By is not allowed or does not exist.

Unfortunately, "Oracle Nashorn"  is not offered as Script Engine when I try to add a new script.

Any ideas how to overcome the access issue in the exception?

Screenshot 2023-01-04 140816.png

thc...@gmail.com

unread,
Jan 4, 2023, 8:03:39 AM1/4/23
to zaprox...@googlegroups.com
Which Java version did you install? Java 11 bundles Nashorn.

Best regards.

On 04/01/2023 12:09, Volodymyr Molodets wrote:
> Yes, that's what I did next.
>
> But after that I am unable to run even builtin standalone scripts on ZAP
> 2.12.0 and getting the same exception as the OP. PFB.[image: Screenshot
> 2023-01-04 140620.png]
>
> Here is the exception:
>
> *org.graalvm.polyglot.PolyglotException: TypeError: Access to host class
> org.openqa.selenium.By is not allowed or does not
> exist.org.graalvm.polyglot.PolyglotException: TypeError: Access to host
> class org.openqa.selenium.By is not allowed or does not exist.*
>
> Unfortunately, "Oracle Nashorn" is not offered as Script Engine when I try
> to add a new script.
>
> Any ideas how to overcome the access issue in the exception?
>
> [image: Screenshot 2023-01-04 140816.png]
>
> On Wednesday, January 4, 2023 at 1:44:45 PM UTC+2 psi...@gmail.com wrote:
>
>> You say you have "Java 8 Update 351 (64-bit) (8.0.3510.10)"
>> But as per the release notes
>> <https://www.zaproxy.org/docs/desktop/releases/2.12.0/>, ZAP 2.12.0

Volodymyr Molodets

unread,
Jan 4, 2023, 8:13:30 AM1/4/23
to OWASP ZAP User Group
This one below. 
Screenshot 2023-01-04 151243.png

Can you share the link for the one which is working for you?

thc...@gmail.com

unread,
Jan 4, 2023, 8:19:39 AM1/4/23
to zaprox...@googlegroups.com
Java 19 no longer includes Nashorn.

You can download Java 11 from:
https://adoptium.net/en-GB/temurin/releases/?version=11

(You need to choose your OS/arch.)

Best regards.

Volodymyr Molodets

unread,
Jan 4, 2023, 8:29:14 AM1/4/23
to OWASP ZAP User Group
It worked, thanks a lot!

Pritish Thapa

unread,
Mar 21, 2023, 8:52:32 AM3/21/23
to OWASP ZAP User Group
Hello,
I have installed JAVA 11, from the link that you have provided, but unfortunately, it is still not working!


P.S: I have attached the screenshots of the Java version and the issue that I am facing!


Any help will be appreciated!

Thank you!


Pritish Thapa
Screenshot 2023-03-21 182611.png
Screenshot 2023-03-21 182535.png

thc...@gmail.com

unread,
Mar 21, 2023, 12:42:43 PM3/21/23
to zaprox...@googlegroups.com
Check in Help > Support Info… which Java version is in use by ZAP.

You need to start ZAP with Java 11 to use/select Nashorn (e.g. edit the
bat file to use the correct path for Java 11, or uninstall Java 17).

Best regards.

Pritish Thapa

unread,
Mar 22, 2023, 2:58:40 AM3/22/23
to OWASP ZAP User Group
Hello everyone, if in case anyone facing an issue

'org.graalvm.polyglot.polyglotexception: typeerror: access to host class org.openqa.selenium.by is not allowed or does not exist.org.graalvm.polyglot.polyglotexception: typeerror: access to host class org.openqa.selenium.by is not allowed or does not exist.'

then install the JAVA 12 from this link (java 12)!


Thank me later.


Pritish Thapa

thc...@gmail.com

unread,
Mar 22, 2023, 5:28:18 AM3/22/23
to zaprox...@googlegroups.com
Java 12 does not include Nashorn, you would still be using Graal JS and
hitting exactly the same issue.

Best regards.

On 22/03/2023 06:58, Pritish Thapa wrote:
> Hello everyone, if in case anyone facing an issue
>
> 'org.graalvm.polyglot.polyglotexception: typeerror: access to host class
> org.openqa.selenium.by is not allowed or does not
> exist.org.graalvm.polyglot.polyglotexception: typeerror: access to host
> class org.openqa.selenium.by is not allowed or does not exist.'
>
> then install the JAVA 12 from this link (java 12
> <https://www.oracle.com/in/java/technologies/javase/jdk12-archive-downloads.html>
> )!

Pritish Thapa

unread,
Mar 22, 2023, 6:45:21 AM3/22/23
to OWASP ZAP User Group
Hello thc202,
Sorry to say but, JDK 12 does have  Nashorn, and I am using it right now without any issue!
You can try it too, once.


Thank you!


Pritish Thapa

Pritish Thapa

unread,
Mar 22, 2023, 6:45:50 AM3/22/23
to OWASP ZAP User Group
besides, it is not showing any kind of errors!

kingthorin+owaspzap

unread,
Mar 22, 2023, 2:05:27 PM3/22/23
to OWASP ZAP User Group
Could you provide the support info that was requested earlier?

umar mehmood

unread,
Oct 18, 2023, 4:56:26 PM10/18/23
to ZAP User Group
hi,

We are using openjdk v11, and ZAP v 2.13.0. and getting this error while authenticating through Java script with Graalljs engine.

" org.graalvm.polyglot.PolyglotException: TypeError: Access to host class org.openqa.selenium.By is not allowed or does not exist.org.graalvm.polyglot.PolyglotException: TypeError: Access to host class org.openqa.selenium.By is not allowed or does not exist."

Please advise..

Thank You

Umar

thc...@gmail.com

unread,
Oct 18, 2023, 7:22:59 PM10/18/23
to zaprox...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages