Forum Discussion

miteshqtg's avatar
miteshqtg
Occasional Contributor
3 years ago
Solved

How to retrieve data from webpage and store into a variable in Keyword test

I am working on a POC and Need to grab values from a webpage and store them in a variable to then be used in the subsequent test. I can know how to pass variable values into tests, just need to be able to read the values of the page and store them in a variable. Please help.

  • Hi, 

    If you are using keyword tests you can use the set variable value operation> Use Object Property mode > Grab the onscreen object that has the variable value> , and select the object property that has the desired variable value result. 

    In script you just set the variable value to the object property you want. For example contentText property in python:
    def SetVariableValue():

    ProjectVariable = Alias.PageObject.Object.ContentText

  • Thanks, Matt!

     

    miteshqtg, hi! Does this answer your question? 

3 Replies

  • Hi, 

    If you are using keyword tests you can use the set variable value operation> Use Object Property mode > Grab the onscreen object that has the variable value> , and select the object property that has the desired variable value result. 

    In script you just set the variable value to the object property you want. For example contentText property in python:
    def SetVariableValue():

    ProjectVariable = Alias.PageObject.Object.ContentText

    • sonya_m's avatar
      sonya_m
      SmartBear Alumni (Retired)

      Thanks, Matt!

       

      miteshqtg, hi! Does this answer your question?