I am relatively new to Java and Selenium.
I have a project (Selenium) created by other developer.
- I created my Java class:
JavaScript
x
public class ST_VladsSteps extends Inter
{
}
- The class which method
SupplierPortalLogin()
I want to use is called
JavaScript
package com.abc.application.def.tests;
public class LoginTest { }
- In my class on the top I have put a statement:
import com.resmed.application.GoScripts.tests.LoginTest;
- In my method,
JavaScript
@When("^User keys in "([^"]*)" and "([^"]*)"$")
public void userProvidesUserNameAndPassword(String UserName) throws InterruptedException {
SupplierPortalLogin(UserName,TempString);
}
When I use the method SupplierPortalLogin(UserName,TempString)
I have an error message,
The method SupplierPortalLogin(String, String) is undefined for the type ST_VladsSteps.
- I can see in the project that other Java classes use the same
import com.resmed.application.GoScripts.tests.LoginTest;
statement and use this method within their methods.
Please, help me to understand what I am doing wrong.
Advertisement
Answer
In my method
@When("^User keys in "([^"])" and "([^"])"$")
Your cucumber step required two arguments but you are passing single argument to the method userProvidesUserNameAndPassword
Current code:
JavaScript
public void userProvidesUserNameAndPassword(String UserName) throws InterruptedException {
SupplierPortalLogin(UserName,TempString);
}
Updated code:
JavaScript
public void userProvidesUserNameAndPassword(String UserName, String TempString) throws InterruptedException {
SupplierPortalLogin(UserName,TempString);
}