groovy.lang.MissingMethodException: Error on Jmeter - java

I'm trying to connect to MongoDB in Jmeter by using JSR223 Sampler. Here is my code:
import com.mongodb.MongoClientURI;
import com.mongodb.MongoClient;
import org.bson.Document;
import com.mongodb.BasicDBObject;
import com.mongodb.ConnectionString;
import com.mongodb.client.FindIterable;
import com.mongodb.client.MongoCursor;
import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoClient;
import com.mongodb.MongoClientSettings;
import com.mongodb.ServerAddress;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import java.util.Arrays;
import com.mongodb.Cursor;
import com.mongodb.DBCursor;
import com.mongodb.DBObject;
try {
MongoClientURI connectionString = new MongoClientURI("mymongodb.com:27017");
MongoClient mongoClient = MongoClients.create(connectionString);
MongoDatabase database = mongoClient.getdatabse("mydatbase");
MongoCollection<Document> collection = database.getCollection("employee");
}
catch (Throwable ex) {
log.error("Error in Beanshell", ex);
throw ex;
}
I'm getting error:
ERROR o.a.j.p.j.s.J.JSR223 Sampler: Error in Beanshell
groovy.lang.MissingMethodException: No signature of method: static com.mongodb.client.MongoClients.create() is applicable for argument types: (com.mongodb.MongoClientURI) values: [mymongodb.com:27017]
Possible solutions: create(), create(com.mongodb.ConnectionString), create(com.mongodb.MongoClientSettings), create(java.lang.String), create(com.mongodb.ConnectionString, com.mongodb.MongoDriverInformation), create(com.mongodb.MongoClientSettings, com.mongodb.MongoDriverInformation)
at groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1518) ~[groovy-all-2.4.16.jar:2.4.16]
at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1504) ~[groovy-all-2.4.16.jar:2.4.16]
at org.codehaus.groovy.runtime.callsite.StaticMetaClassSite.call(StaticMetaClassSite.java:52) ~[groovy-all-2.4.16.jar:2.4.16]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) [groovy-all-2.4.16.jar:2.4.16]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) [groovy-all-2.4.16.jar:2.4.16]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128) [groovy-all-2.4.16.jar:2.4.16]
at Script11.run(Script11.groovy:44) [script:?]
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:321) [groovy-all-2.4.16.jar:2.4.16]
at org.codehaus.groovy.jsr223.GroovyCompiledScript.eval(GroovyCompiledScript.java:72) [groovy-all-2.4.16.jar:2.4.16]
at javax.script.CompiledScript.eval(CompiledScript.java:89) [java.scripting:?]
at org.apache.jmeter.util.JSR223TestElement.processFileOrScript(JSR223TestElement.java:223) [ApacheJMeter_core.jar:5.1.1 r1855137]
at org.apache.jmeter.protocol.java.sampler.JSR223Sampler.sample(JSR223Sampler.java:71) [ApacheJMeter_java.jar:5.1.1 r1855137]
at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:622) [ApacheJMeter_core.jar:5.1.1 r1855137]
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:546) [ApacheJMeter_core.jar:5.1.1 r1855137]
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:486) [ApacheJMeter_core.jar:5.1.1 r1855137]
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:253) [ApacheJMeter_core.jar:5.1.1 r1855137]
at java.lang.Thread.run(Thread.java:834) [?:?]
Anyone has any ideas? Many Thanks!

Your code relies on a diamond operator which is not supported in Beanshell.
Be aware that starting from JMeter 3.1 you should be using JSR223 Test Elements and Groovy language for scripting so consider choosing groovy as the scripting language and your code should start working normally
You might also be interested in MongoDB Performance Testing with JMeter article

Related

JavaFX access error, not sure what's causing it [duplicate]

This question already has answers here:
can not access a member of class org.springframework.aop.TruePointcut with modifiers public
(3 answers)
Closed 10 months ago.
This is my code (I removed a lot of graphics logic as to see if it would run a most basic file)
import java.util.Scanner;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
import java.util.Scanner;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
class Client extends Application {
public static String host = "127.0.0.1";
public BufferedReader fromServer;
public PrintWriter toServer;
public Scanner consoleInput = new Scanner(System.in);
public Client() {
}
public static void main(String[] args) {
launch(args);
}
public void start(Stage displayStage) {
try {
System.out.println("HELLO");
} catch (Exception e) {
System.err.println("Client connection error!");
e.printStackTrace();
}
}
}
but the error messages are really bizarre and I'm not sure what exactly it means; it mentions a public access but afaik, public means anything can access it and I don't use reflection but its throwing errors regarding reflection and I'm really stumpted as to what could be causing this error.
Exception in Application constructor
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1071)
Caused by: java.lang.RuntimeException: Unable to construct Application instance: class eHillsClient.Client
at javafx.graphics#18/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:891)
at javafx.graphics#18/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.IllegalAccessException: class com.sun.javafx.application.LauncherImpl (in module javafx.graphics) cannot access a member of class eHillsClient.Client with modifiers "public"
at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:489)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
at javafx.graphics#18/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:803)
at javafx.graphics#18/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:484)
at javafx.graphics#18/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:457)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at javafx.graphics#18/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:456)
at javafx.graphics#18/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics#18/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics#18/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:184)
... 1 more
Make Client class public because a main class in JavaFX Applicaions must have a public access modifier to be picked by getConstructor() method in Application class.In normal cases it wouldn't cause an error but your main class will not be an entry point to the program(in JavaFx Applicaions the entry points is Applicaion class).
You can further read here

Validating JWT claims using nimbus jose-jwt (java)

I am using nimbus jost+jwt version 8.19 in a normal java project (not using spring). I have some claims such as iss, aud and sub and want to validate them. (I want iss, aud and sub to be a specific value). I want the parser to throw an exception when the claims dont match.
The example provided here worked fine in earlier versions , But it seems like it was changed in later versions.
Earlier (version 8.3) I used to validate using the following code
JWKSet jwkSet = new JWKSet(utils.rsakey);
JWKSource<SecurityContext> jwkSource = new ImmutableJWKSet<>(jwkSet);
ConfigurableJWTProcessor<SecurityContext> jwtProcessor = new DefaultJWTProcessor<>();
jwtProcessor.setJWSTypeVerifier(new DefaultJOSEObjectTypeVerifier<>(new JOSEObjectType("jwt")));
JWSAlgorithm expectedJWSAlg = JWSAlgorithm.RS256;
JWTClaimsSet validClaims= new JWTClaimsSet.Builder()
.issuer(InetAddress.getLocalHost().getHostName()
.subject("matchvalue")
.audience("matchvalue")
.build();
JWSKeySelector<SecurityContext> keySelector =
new JWSVerificationKeySelector<>(expectedJWSAlg, jwkSource);
jwtProcessor.setJWTClaimsSetVerifier(new DefaultJWTClaimsVerifier(
//exact match claims
validClaims,
//Required claims
new HashSet<>(Arrays.asList("exp", "sub","iss"))));
jwtProcessor.setJWSKeySelector(keySelector);
// Process the token
SecurityContext ctx = null; // optional context parameter, not required here
JWTClaimsSet tokenClaims= jwtProcessor.process(token, ctx);
but now (version 8.19) the DefaultJWTClaimsVerifier does not seem to be accepting exact match claims and Required claims parameters. Is there any way to implement the exact match and required claims?
All of my imports for refrence
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.text.ParseException;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.ws.rs.FormParam;
import javax.ws.rs.core.Response;
import com.nimbusds.jose.EncryptionMethod;
import com.nimbusds.jose.JOSEException;
import com.nimbusds.jose.JOSEObjectType;
import com.nimbusds.jose.JWEAlgorithm;
import com.nimbusds.jose.JWEHeader;
import com.nimbusds.jose.JWEObject;
import com.nimbusds.jose.JWSAlgorithm;
import com.nimbusds.jose.JWSHeader;
import com.nimbusds.jose.JWSSigner;
import com.nimbusds.jose.KeyLengthException;
import com.nimbusds.jose.Payload;
import com.nimbusds.jose.crypto.DirectDecrypter;
import com.nimbusds.jose.crypto.RSAEncrypter;
import com.nimbusds.jose.crypto.RSASSASigner;
import com.nimbusds.jose.jwk.JWKSet;
import com.nimbusds.jose.jwk.KeyUse;
import com.nimbusds.jose.jwk.RSAKey;
import com.nimbusds.jose.jwk.gen.RSAKeyGenerator;
import com.nimbusds.jose.jwk.source.ImmutableJWKSet;
import com.nimbusds.jose.jwk.source.JWKSource;
import com.nimbusds.jose.proc.BadJOSEException;
import com.nimbusds.jose.proc.DefaultJOSEObjectTypeVerifier;
import com.nimbusds.jose.proc.JWSKeySelector;
import com.nimbusds.jose.proc.JWSVerificationKeySelector;
import com.nimbusds.jose.proc.SecurityContext;
import com.nimbusds.jwt.JWTClaimsSet;
import com.nimbusds.jwt.SignedJWT;
import com.nimbusds.jwt.proc.ConfigurableJWTProcessor;
import com.nimbusds.jwt.proc.DefaultJWTClaimsVerifier;
import com.nimbusds.jwt.proc.DefaultJWTProcessor;

org.powermock.reflect.exceptions.FieldNotFoundException

Good day I've got class with 2 methods: first is public GetLeadRequestsList - I want to test it, and second is private LeadRequestListResponse - used by first method. I mocked second method and called first one. Code of my test is here. When I run testGetLeadRequestsList, I catched
org.powermock.reflect.exceptions.FieldNotFoundException: No static field of type "org.mockito.internal.progress.MockingProgress" could be found in the class hierarchy of org.mockito.Mockito.
at org.powermock.reflect.internal.matcherstrategies.FieldTypeMatcherStrategy.notFound(FieldTypeMatcherStrategy.java:40)
at org.powermock.reflect.internal.WhiteboxImpl.findSingleFieldUsingStrategy(WhiteboxImpl.java:502)
at org.powermock.reflect.internal.WhiteboxImpl.findFieldInHierarchy(WhiteboxImpl.java:455)
at org.powermock.reflect.internal.WhiteboxImpl.getInternalState(WhiteboxImpl.java:576)
at org.powermock.reflect.Whitebox.getInternalState(Whitebox.java:347)
at org.powermock.api.mockito.internal.PowerMockitoCore.getMockingProgress(PowerMockitoCore.java:45)
at org.powermock.api.mockito.internal.PowerMockitoCore.doAnswer(PowerMockitoCore.java:36)
at org.powermock.api.mockito.PowerMockito.doReturn(PowerMockito.java:790)
at ru.sbrf.sbi.ufs.business.rest.api.LeadRequestsControllerImplTest.setUp(LeadRequestsControllerImplTest.java:58)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:514)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:215)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:589)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:782)
at org.testng.TestRunner.run(TestRunner.java:632)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
at org.testng.SuiteRunner.run(SuiteRunner.java:268)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
at org.testng.TestNG.run(TestNG.java:1064)
at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:110)
error in testclass is in the String:
doReturn(leadRequestsResponse).when(mock, "LeadRequestListResponse", ArgumentMatchers.anyBoolean());
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.runner.RunWith;
import org.mockito.*;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import ru.sbrf.sbi.ufs.poi.vo.ErrorMessage;
import ru.sbrf.sbi.ufs.poi.vo.LeadRequestData;
import ru.sbrf.sbi.ufs.poi.vo.LeadRequestListResponse;
import ru.sbrf.sbi.ufs.poi.vo.ResponseStatus;
import java.util.ArrayList;
import static org.powermock.api.mockito.PowerMockito.*;
import static org.testng.Assert.*;
public class LeadRequestsControllerImplTest {
#Spy
LeadRequestsControllerImpl mock = new LeadRequestsControllerImpl();
LeadRequestListResponse leadRequestsResponse;
#BeforeMethod
public void setUp() throws Exception {
leadRequestsResponse = new LeadRequestListResponse();
leadRequestsResponse.setResponseStatus(new ResponseStatus().withStatusCode(200L));
ArrayList<LeadRequestData> requests = new ArrayList<>();
requests.add(LeadRequestData.builder()
.companyName("НПО Помощь")
.lastName("Помоги")
.firstName("Себе")
.secondName("Сам")
.build());
leadRequestsResponse.setRequests(requests);
doReturn(leadRequestsResponse).when(mock, "LeadRequestListResponse", ArgumentMatchers.anyBoolean());
}
#Test
public void testGetLeadRequestsList() {
try {
String result = mock.getLeadRequestsList();
ObjectMapper mapper = new ObjectMapper();
String expect = mapper.writeValueAsString(leadRequestsResponse);
assertEquals(expect, result,"GetLeadRequestsList isn't correct.");
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}
Maybe, anybody know how to check with Error.
Thank's in advance
I suppose you use not correct versions of mockito-core and powermock-api-mockito. Because FieldNotFoundException could be if using not compatible versions of these libraries. Please use support versions chart - https://github.com/powermock/powermock/wiki/Mockito#supported-versions
So you need check your versions and correct it.
Also you should do next things:
Add #RunWith(PowerMockRunner.class) and #PrepareForTest(LeadRequestsControllerImpl.class) before LeadRequestsControllerImplTest
Change from TestNG #BeforeMethod to JUnit annotations (for example #BeforeClass) because you can't mixed it.

How to fix "java.lang.error" in java HtmlUnitDriver

I'm trying to log into a website with HtmlUnitDriver and I keep getting a java.lang.error.
Ive added multiple jars to fix my com.gargoylesoftware.htmlunit.browserversion error which fixed that but caused another problem.
import org.jsoup.Connection;
import org.jsoup.Connection.Response;
import org.jsoup.Connection.Method;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import java.io.IOException;
import java.net.CookieHandler;
import java.net.CookieManager;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.HasInputDevices;
public class selenium
public static void main ( String[] args ) throws IOException {
HtmlUnitDriver driver = new HtmlUnitDriver(true); // line that shows a error
String baseUrl = "website";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.get(baseUrl);
driver.findElement(By.name("username")).clear();
driver.findElement(By.name("username")).sendKeys("username");
driver.findElement(By.name("password")).clear();
driver.findElement(By.name("password")).sendKeys("password");
driver.findElement(By.cssSelector("input[type='submit']")).click();
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
HtmlUnitDriver cannot be resolved to a type
HtmlUnitDriver cannot be resolved to a type
Syntax error, insert "}" to complete ClassBody

Selenium/Cucumber not seeing step definitions after folder migration

Dependencies used for this:
cucumber-core-1.2.4
cucumber.html-0.2.3
cucumber-java-1.2.4
cucumber-junit-1.2.4
junit-4.11
gherkin-2.12.2
cucumber-jvm-deps-1.0.3
I recently cleaned up my dependencies folder structure and think I might have misplaced something, but my problem is an instantiation issue that doesn't make sense as it seems I have my ducks in a row on the cucumber side. Here is the stack trace:
cucumber.runtime.CucumberException: Failed to instantiate class cucumber.feature.LoginandMeetingCreation
at cucumber.runtime.java.DefaultJavaObjectFactory.cacheNewInstance(DefaultJavaObjectFactory.java:46)
at cucumber.runtime.java.DefaultJavaObjectFactory.getInstance(DefaultJavaObjectFactory.java:32)
at cucumber.runtime.java.JavaStepDefinition.execute(JavaStepDefinition.java:38)
at cucumber.runtime.StepDefinitionMatch.runStep(StepDefinitionMatch.java:37)
at cucumber.runtime.Runtime.runStep(Runtime.java:299)
at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:44)
at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:39)
at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:44)
at cucumber.runtime.model.CucumberFeature.run(CucumberFeature.java:165)
at cucumber.runtime.Runtime.run(Runtime.java:121)
at cucumber.api.cli.Main.run(Main.java:36)
at cucumber.api.cli.Main.main(Main.java:18)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at cucumber.runtime.java.DefaultJavaObjectFactory.cacheNewInstance(DefaultJavaObjectFactory.java:40)
... 11 more
Caused by: java.lang.NullPointerException
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:770)
at org.openqa.selenium.support.ui.FluentWait.<init>(FluentWait.java:96)
at org.openqa.selenium.support.ui.WebDriverWait.<init>(WebDriverWait.java:71)
at org.openqa.selenium.support.ui.WebDriverWait.<init>(WebDriverWait.java:45)
at cucumber.feature.LoginandMeetingCreation.<init>(LoginandMeetingCreation.java:19)
... 16 more
Here is my cucumber runner that sets up the feature files, but never executes the glue command. My package cucumber.feature contains my step definition file LoginandMeetingCreation.java file:
package cucumberInitialization;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
#RunWith(Cucumber.class)
#CucumberOptions(
plugin = {"pretty" , "json:target/cucumber.json"},
features = {"src/cucumber/"},
monochrome = true,
glue = {"cucumber.feature"}
)
public class cucumberRunner {
}
Feature file with steps:
Feature: Create a meeting and fill in the necessary text fields
Scenario: As a user, login and create a meeting
Given I navigated to the site
When I login and select an org
Then Create a meeting
And finally my step definitions:
package cucumber.feature;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import cucumber.api.PendingException;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class LoginandMeetingCreation {
WebDriver chromeDriver = null;
WebDriver ieDriver = null;
//open IE and Chrome browsers and go to Website
#Given("^I navigated to the site$")
public void navigateToWebsite() throws Throwable{
throw new PendingException();
}
//login users
#When("^I login and select an org$")
public void userLogin() throws Throwable{
throw new PendingException();
}
#Then("^Create a meeting$")
public void meetingCreation() throws Throwable{
throw new PendingException();
}
}
Any advice?
Thanks GalexMES.
You were right, I had forgotten I had deleted a bulk amount and it dawned on me I was creating an object that cannot accept a null value. When I had written WebDriverWait wait = new WebDriverWait(ieDriver, 5); ieDriver was null, which causes the NPE. Once I create the ieDriver object from a non null value the expected behavior is executed.

Categories

Resources