Vladimir
Vladimir

Reputation: 668

JMeter WebDriver Sampler Error for Java

By default, jp@gc - WebDriver Sampler has javascript as a Script Language.
As soon as I switch to java, I get this error message.

ReferenceError: "ImportPackage" is not defined in at line number 2.

I use JMeter 3.2 and Java 1.8.

Upvotes: 0

Views: 1191

Answers (2)

A. Sundararajan
A. Sundararajan

Reputation: 4405

With nashorn, importPackage is not defined by default. But, you can eval the following line to get few Rhino compatibility features:

load("nashorn:mozilla_compat.js");

See also: https://wiki.openjdk.java.net/display/Nashorn/Rhino+Migration+Guide

Upvotes: 1

Dmitri T
Dmitri T

Reputation: 168147

There is a bug in the WebDriver Sampler plugin, you can report it via JMeter Plugins support forum. For the time being there is no fix so currently you have the following options:

  1. Ignore. This message can be annoying however it isn't critical and you can continue working.
  2. Switch to JavaScript language
  3. Downgrade to JMeter 3.1 and JDK 7 as Rhino JavaScript Engine used in JDK 6 and 7 has this ImportPackage function while Nashorn JavaScript Engine which comes with JDK8 doesn't.

Upvotes: 1

Related Questions