Get value response HTML

Guys, I have a problem with my test, I need get a value of a response , but this response is in HTML.
Is a value inside an input tag with a token for I use in another POST, I wanna putting in a variable.
but the return of the response is in HTML.

Do you know how I do for solving this ?

${response} Get ${URL}
${response_body} Set Variable ${response.content}

Log ${response_body}

Hi Newton,

Are you using GET from Requests Library? or something else?

Working on the assumption you are using Requests Library, then Response Object tells you what you can get from ${response}, you probably want ${response.text} which will be the html response.

  • One option would be to use Get Regexp Matches or one of the other keywords from String Library to pull the value you want from the html
  • Another option might be to use the XML library Parse XML and Get Element Attribute to pull the value using an xpath, in my experience the XML parser doesn’t always work with html but it might be worth a try.

Hope that helps,

Dave.

thank you Dave, I’ve solve my problem treating the strings

1 Like

Hello Newton,

May I know how to extract the variable from the html response?

Thank you in advance.

Hi @oearhp,

Every website/application is different, what might have worked for Newton may not work for you, this is why I gave a couple of options to try, as you need work out what works best for your website/application.

Dave.