[英]Is there any way to open a website with specified cookies in a browser using Powershell?
Is there any way I can use Powershell to open a website in a browser with the cookies specified?有什么方法可以使用 Powershell 在指定 cookies 的浏览器中打开网站?
Yes, by preparing a WebRequestSession
instance for use with the Invoke-WebRequest
cmdlet :是的,通过准备一个
WebRequestSession
实例以与Invoke-WebRequest
cmdlet一起使用:
$uri = "https://some.website.example/path/page"
$session = [Microsoft.PowerShell.Commands.WebRequestSession]::new()
$session.Cookies.Add($uri, [System.Net.Cookie]::new("CookieName", "Value"))
Invoke-WebRequest $uri -WebSession $session
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.