This page explains how to get the text content of a web page element and then use that value in a subsequent step, without needing additional JavaScript or Playwright code.
Some example use cases include:
Getting a user ID that is automatically generated after new user registration and use that ID to log in.
Getting a confirmation number displayed after submitting a form and enter that number into a search box to perform a search.
Steps
Add an "Assert text" or "Equals value" assertion step for the element from which you want to get the value.
.png?sv=2022-11-02&spr=https&st=2025-11-06T16%3A39%3A14Z&se=2025-11-06T16%3A50%3A14Z&sr=c&sp=r&sig=YjxK%2FDmBBZwjTDulqIlT1%2B3iE8RF%2BYZxHaoMQ1%2Bao5c%3D)
Tip
If you just want to get the text of an element and don’t care what the actual text value is, you should set the assertion to always succeed and the “Text” field of the assertion to be empty.
Go to the step where you want to use the retrieved text (e.g., an "Input text" step) and click the pencil icon on the right.
In the “Edit assertion” modal dialog that is shown, click the dropdown that says “Given value” and select "Other step's output."
Select the assertion step created in step 1 from the dropdown list that appears.
Click the "Save" button to confirm the changes.
Once the setup is complete, a link icon will be displayed in the later step that indicates its action value references the execution result of another step.
Notes
The value passed to the subsequent step with this feature is the actual text (or form value) displayed on the target element, not the value you specified for validation in the assertion step.
Steps that reference another step’s output cannot be exported to Playwright code.
If it is not possible to get the desired element text content with a basic assertion step, a Playwright code step can be used in place of step 1 above.