There are some parts of the code listed on the following site that I don't understand.
Why are you substituting Forms[0]
for $response
?What does it mean?
$form=$response.Forms[0]
Also, the code below is an error.Why?
$response="aaa"
$form=$response.Form[0]
The previous code is important.
$response=Invoke-WebRequest-Uri$myUrl-Method GET-SessionVariable mySession
$form=$response.Forms[0]
and so on.Now it's important to know what Invoke-WebRequest
is the cmdlet that outputs.The Notes section of the document contains
PowerShell 6.0.0 Invoke-WebRequest and later support only basic analysis.
As stated, behavior differs between 6.0 and later and less than 6.0.With that in mind, if you look at the output , you can see
and See 5.1 output for As stated in the note, you can see that there is a specification change in the output.As you can see by looking at each link, the The documentation you referred to is probably intended for PowerShell 5.1.In fact, the post date is June 27, 2016, but PowerShell Core 6.0.0 will be released on June 1, 2018.HtmlWebResponseObject
output from 5.1 has the Forms
property, but BasicHtmlWebRespon outputting 7.2It does not exist in seObject
.
Maybe it's because it's $response as a way to save $myUrl sessions and post forms.
I'm not sure if I can, but I'll give you a SessionValue and replace aaa with username.
© 2024 OneMinuteCode. All rights reserved.