Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
206 views
in Technique[技术] by (71.8m points)

How to get the text from a particular xpath and how to store that in a string using Serenity

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 ...

question from:https://stackoverflow.com/questions/65842600/how-to-get-the-text-from-a-particular-xpath-and-how-to-store-that-in-a-string-us

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...