Forum Discussion

rhu's avatar
rhu
Contributor
11 months ago
Solved

How to assign a copied text string to a variable?

My keyword test looks like: Open a web page Make a swagger request Then I get the swagger result (lines of text) mark a part of it and copy it. After that i set it to a variable So it looks like...
  • rhu's avatar
    11 months ago

    Thanks for help.
    I was now able to solve the problem.
    I used the object property to find the correct text and assigned it to a persistent variable as i needed the customer number later on at another test.
    so the test-step could look like this

    Item: Set Variable Value Operation here i selected the Persistent variable Value - here i entered the object propertiy.
    Nevertheless it is still not perfect as my customer number is always unique, but when running the test again selfhealing finds the new number, copies it and the test is working with the yellow symbol

  • rraghvani's avatar
    11 months ago

    If you are trying to extract the customer number from a string, then think about using regular expression.

     

    Ideally, you shouldn't use ^c and ^v to copy and paste text. Use the Object Spy tool to see which properties you can use, such as contentText. And then work from there.