So I have a selenium code and I defined the step in step-definition file as, in here I am returning the value of appId which we are fetching from chrome console and then we need to use it in our feature file:
@And("we get appId from console"){
public String weGetAppIdfromConsole()
JavaScriptExecutor executor=(Javascript Executor)driver;
String appId=(String)executor.executeScript("return page_data.application_id");
System.out.println(appId);
return appId;
}
Now I need to use this returned appId in my feature file:
When we fill in following details:
|applicationId| text| Here I need to pass the appId|
How to acheive this?
I tried using appId directly as:
When we fill in following details:
|applicationId| text | appId|
It’s printing appId in the applicationId field instead of the appId returned. For example appId returned is ‘SUMI1234’ , it’s printing ‘appId’ in the applicationId field.