I want to fetch the text from an xpath and store it in a string.
After entering all inputs and submitting , a new code will get generated and which looks like Customercode: IN02732114(number will dynamic).
Now i want to fetch this code and store it in a string and later I want to use this string in other steps to search the data with this code.
i have used below different snippets to get the text from the xpath.
public static Question customer_code_value() { return actor -> Text.of(CustomerCreatePage.CUSTOMER_CODE_TEXT).viewedBy(actor).asString().substring(15, 26); }
String code= customer_code_value(); // trying to store the value in String code
but customer_code_value() method returns in Question and cant store in String.
Need some help on how to get the text and store it in string in Serenity. Please help me ...