I'm trying to extract data returned from API in html format from the following tag. I need the value.
<input name="__RequestVerificationToken" type="hidden"
value="CfDJ8HAHZQfAcMxBmpaspuVDRFPEKRneMMKaS7FGTmqmlPl-
xzvjkuePYhTesJqt0FABIwdSzEok25kZRCLzWX_8tdmtmCRJnrdYrP2PR-HZXcFzcGaSuQXbtL4qS6xfjlW_1qVAdMilo8Js9XzdEqlKsB3EKLKNqqubcsT98AkfbJTisZO_Q9vXg8crfafEouhBFQ" />
*** Settings *** Library RequestsLibrary Library XML
*** Variables *** ${login_url} https://testworthy.us
*** Test Cases *** get api Create Session mysession ${login_url} ${response}= Get Request mysession /Login Log To Console ${response.content}
The error tells you exactly what the problem is: it doesn't know what user1
is. user1
comes from a variable, but you still need to use quotes when forming a valid reference to the data:
${username}= Set Variable ${user_data['users']['${user_key}']['username']}
${user_data['users']['user1']['username']}
# ^ ^