Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 用于自动单击按钮的Powershell脚本_Windows_Powershell - Fatal编程技术网

Windows 用于自动单击按钮的Powershell脚本

Windows 用于自动单击按钮的Powershell脚本,windows,powershell,Windows,Powershell,通过powershell,我们需要自动搜索站点并单击它。这是在访问网站后,然后在搜索框中输入单词,例如:“Linux”进行搜索,然后我们需要按下一个按钮。检查按钮时,其显示如下: <button class="ico-search" onclick="frmSiteSearch_conductSearch(); return false;"></button> 通过powershell,任何人都可以在这方面帮助我 $toclick = $ie.document.getE

通过powershell,我们需要自动搜索站点并单击它。这是在访问网站后,然后在搜索框中输入单词,例如:“Linux”进行搜索,然后我们需要按下一个按钮。检查按钮时,其显示如下:

<button class="ico-search" onclick="frmSiteSearch_conductSearch(); return false;"></button>
通过powershell,任何人都可以在这方面帮助我

$toclick = $ie.document.getElementById("ico-search")
$toclick.click()

试试看,我想您是在尝试对搜索而不是实际元素调用click方法

这似乎是一个点击搜索方法。检查按钮时,它显示为。你能帮我一下吗。
getElementById(“ico搜索”)
@gvee你能写得更详细一点吗。对不起,我不是程序员。您的按钮具有“ico搜索”类别。您的JavaScript正在调用名为getElementBy Id()的函数。类与Id不同,因此函数找不到要将
Click()
事件附加到的元素!
$toclick = $ie.document.getElementById("ico-search")
$toclick.click()