java - Response message: org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of: -
when replace selenium-server-standalone-2.53.0 selenium-server-standalone-3.1.0 in %jmeter%lib folder i'm getting error:
response message: org.apache.jorphan.util.jmeterexception: error invoking bsh method: eval sourced file: inline evaluation of: ``import java.io.file; import java.io.filereader; import java.io.filewriter; impor . . . ''
import java.io.file; import java.io.filereader; import java.io.filewriter; import java.io.ioexception; import java.util.list; import org.junit.after; import org.junit.before; import org.junit.test; import org.openqa.selenium.by; import org.openqa.selenium.javascriptexecutor; import org.openqa.selenium.webdriver; import org.openqa.selenium.chrome.chromedriver; import org.openqa.selenium.phantomjs.phantomjsdriver; import org.openqa.selenium.support.ui.expectedconditions; import org.openqa.selenium.support.ui.select; import org.openqa.selenium.support.ui.webdriverwait; import au.com.bytecode.opencsv.csvreader; import au.com.bytecode.opencsesrv.csvwriter; boolean result=true; public webdriver driver; try { system.setproperty("webdriver.chrome.driver","projects\\chromedriver.exe"); driver=new chromedriver(); driver.manage().window().maximize(); driver.get("https://something.com/registration/"); webdriverwait wait = new webdriverwait(driver, 20000); string uname= bsh.args[0]; string pass= bsh.args[1]; // logged in driver.findelement(by.xpath("//*[contains(@id,'menu-item')]//*[text()='log in']")).click(); driver.findelement(by.id("username")).sendkeys(new string[] {uname}); driver.findelement(by.id("password")).sendkeys(new string[] {pass}); driver.findelement(by.xpath("//*[@id='woocommerce-login-nonce']/following-sibling::*[@name='login']")).click(); // logged out driver.findelement(by.xpath("//*[@id='masthead']//*[text()='sign out']")).click(); } catch (exception ex) { ex.printstacktrace(); issuccess = false; responsecode = "500"; responsemessage = ex.getmessage(); log.error(ex.getmessage()); system.err.println(ex.getmessage()); } catch (throwable thex) { system.err.println(thex.getmessage()); } { driver.quit(); } issuccess=result; return result;
code written in beanshell sampler in jmeter.
replacing 1 selenium library not enough, need upgrade other dependencies well
- install clean jmeter
- download http://selenium-release.storage.googleapis.com/3.1/selenium-java-3.1.0.zip file , unpack all .jars somewhere jmeter classpath (jmeter's "lib" folder fine)
- restart jmeter pick .jars up
in order see "normal" stacktrace amend catch block like:
catch (exception ex) { log.error("something went wrong", ex); }
- consider switching jsr223 sampler , groovy language groovy more java-compliant , has better performance. see apache groovy - why , how should use it more detailed explanation.
Comments
Post a Comment