How to extract Form action value from the response

Hi Team,

I want to extract a form action value from the response.

Here is the sample response body

</p>
<form id="myform" action="capture this value" method="post" class="login-form" novalidate>
	<div class="form">
		<label for="username">Email</label>
		<input type="email" id="username" name="username" value="" autoComplete="off"

I tried below code, but nothing work.

let myRes=http.get(‘http:\mysite.com’);
let extractValue=parseHTML(myRes.body).find(‘form’);

OR
let extractValue= myRes.html().find(‘form’).first().attr(‘action’);

Guide me on this.

This value works
let extractValue= myRes.html().find(‘form#myform’).attr(‘action’);

1 Like