2
votes

I have installed J-meters on windows 10 using standard procedure however when I run the code given at the bottom, it is not able to recognize below code of lines in first para and throws errors given in the second para below. Note: Also refer Other observations pasted at the bottom

Code of lines which the Jmeter is not recognizing:
//## Initaite the Packages
var pkg = JavaImporter(org.openqa.selenium, org.openqa.selenium.support.ui); //WebDriver classes- for Form Fillup
var support_ui = JavaImporter(org.openqa.selenium.support.ui.WebDriverWait); //WebDriver classes
var wait = new support_ui.WebDriverWait(WDS.browser, 20000);
Errors:
timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,URL,Latency,IdleTime,Connect
1603175425470,10,jp@gc - WebDriver Sampler,500,"Sourced file: inline evaluation of: ``WDS.sampleResult.sampleStart();  //## Initaite the Packages var pkg = JavaImport . . . '' : Typed variable declaration : Class or variable not found: org.openqa.selenium : at Line: 4 : in file: inline evaluation of: ``WDS.sampleResult.sampleStart();  //## Initaite the Packages var pkg = JavaImport . . . '' : org .openqa .selenium 
 in inline evaluation of: ``WDS.sampleResult.sampleStart();  //## Initaite the Packages var pkg = JavaImport . . . '' at line number 4",For Each User Test 1-1,text,false,,1214,0,1,1,null,0,0,0
1603175425498,1,Debug Sampler,200,OK,For Each User Test 1-1,text,true,,386,0,1,1,null,0,0,0
Full Code/Script: 
WDS.sampleResult.sampleStart();

//## Initaite the Packages
var pkg = JavaImporter(org.openqa.selenium, org.openqa.selenium.support.ui); //WebDriver classes- for Form Fillup
var support_ui = JavaImporter(org.openqa.selenium.support.ui.WebDriverWait); //WebDriver classes
var wait = new support_ui.WebDriverWait(WDS.browser, 20000);

//WDS.sampleResult.sampleStart();
WDS.log.info("Test Script started");
WDS.browser.get("https://capacitytracker-dev.necsu.nhs.uk/");

var login_url = WDS.args[0];

// increase browser size, strangely this is required when running in headless mode 
WDS.browser.manage().window().setSize(new org.openqa.selenium.Dimension(1920, 1080));

WDS.log.info(login_url);
WDS.browser.get(login_url);

var homeurl= WDS.browser.geturl();

wait.until(pkg.ExpectedConditions.presenceOfElementLocated(pkg.By.id('Username')));

WDS.log.info(homeurl);
WDS.sampleResult.sampleEnd();

Other Observations: 1.In Selenium Webdriver script for Language, I don't see Java Script option. I only have Java option.(screen shot attached):[Language:Javascript not available] 2.When I run the J-meter Webdriver Script ,I am getting given below error: Window Defender is blocking some of the features of JDK.

1
Hi Friends, I am really stuck, appreciate if you can help me. with kind regards,Mubbashshir - Mubbashshir Mohiuddin
Did you find any solution to this? i'm stuck at the same position - TrulyXax

1 Answers

-1
votes

I see some additional space replace first line

var pkg = JavaImporter(org.openqa.selenium, org.openqa.selenium.support.ui);

with

var pkg = JavaImporter(org.openqa.selenium,org.openqa.selenium.support.ui);

See if that works.