小编use*_*341的帖子

Powershell 向下滚动网页/Powershell 屏幕截图

如何在powershell中打开网页并向下滚动。

实际上,我正在制作一个脚本,它会自行生成网络报告并给我一个我想要的屏幕截图。我可以打开网页并使用我的脚本开始测试,但我希望我的脚本向下滚动以便可以获取正确的屏幕截图。请帮忙。

确切地说,我希望我的脚本打开一个名为 testmy.net 的网站并进行网络报告。我只想截取报告的屏幕截图并裁剪其他所有内容。我真的很感激任何帮助。

Q) 如何在 PS 中向下滚动网页?我打开网站,我想向下滚动?

问) 如何只截取特定事物的屏幕截图?(经过一番研究,我得到了一些可以截取整个桌面截图的部分)

我附上了我需要的确切东西的截图。

一张图片显示了 OP 希望他的截图看起来像什么

脚本从这里开始:

$ie = new-object -comobject InternetExplorer.Application -property `
    @{navigate2="http://testmy.net/SmarTest/combinedAuto"; visible = $true}

# Wait for the page to finish loading

$ie.fullscreen = $true

do {sleep 5} until (-not ($ie.Busy))

# Take A ScreenShot (Script taken from Stackflow)
[Reflection.Assembly]::LoadWithPartialName("System.Drawing")
function screenshot([Drawing.Rectangle]$bounds, $path) {
$bmp = New-Object Drawing.Bitmap $bounds.width, $bounds.height
$graphics = [Drawing.Graphics]::FromImage($bmp)

$graphics.CopyFromScreen($bounds.Location, [Drawing.Point]::Empty, $bounds.size)

$bmp.Save($path)

$graphics.Dispose()
$bmp.Dispose()
}

$bounds = [Drawing.Rectangle]::FromLTRB(0, 0, 1000, 900)
screenshot $bounds "C:\screenshot.png"
Run Code Online (Sandbox Code Playgroud)

html javascript css powershell jquery

5
推荐指数
1
解决办法
5054
查看次数

标签 统计

css ×1

html ×1

javascript ×1

jquery ×1

powershell ×1