简体   繁体   English

有没有办法在使用 Powershell 的浏览器中打开指定 cookies 的网站?

[英]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.

相关问题 IIS 10 - 有没有办法使用 powershell 在网站上设置 overrideMode="Allow" ? - IIS 10 - Any way to set overrideMode="Allow" on website using powershell? 使用Powershell打开指定的VPN连接对话框 - Open a Specified VPN Connection dialogue using powershell 有没有办法使用 Python 以管理员身份打开 Windows PowerShell? - Is there a way to open Windows PowerShell as administrator using Python? 在 PowerShell 中使用“using”语句的任何动态方式? - Any dynamic way to use "using" statement in PowerShell? 有没有办法使用powershell在文件夹上找到“元数据” - Is there any way to find 'metadata' on folders using powershell 使用Powershell将信息发送到网站而无需打开Web浏览器 - Using powershell to send information to a website without opening a web browser PowerShell 随机打开关闭浏览器 - PowerShell Open Close Browser Randomly 在PowerShell中,是否有一种无需使用浏览器即可获取URL文本的方法? - In PowerShell, is there a way to get the text of a URL without using a browser? 使用PowerShell打开.txt文件中的URL最简单的方法 - Simplest way to open the URL in the .txt file using PowerShell 有没有最简单的方法使用powershell解压缩文件夹和子文件夹 - Is there any easiest way to unzip folders and sub folders using powershell
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM