Reputation: 7
When I replace selenium-server-standalone-2.53.0 by the selenium-server-standalone-3.1.0 in %Jmeter%lib folder then I'm getting this 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());
}
finally
{
driver.quit();
}
IsSuccess=result;
return result;
Code is written in Beanshell Sampler in Jmeter.
Upvotes: 0
Views: 3449
Reputation: 168147
Replacing just only one Selenium library is not enough, you need to upgrade other dependencies as well
In order to see the "normal" stacktrace amend your catch block to look like:
catch (Exception ex) {
log.error("Something went wrong", ex);
}
Upvotes: 0