I need to click on a hyperlink in a aspx webform using powershell. How can I achieve this? Also that link shows a drop down menu and I have to select the right option from that link.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
$ie = new-object -com internetexplorer.application
$ie.visible=$true
$ie.navigate('http://www.somewhere.com')
while($ie.busy) {sleep 1}
$link = $ie.Document.getElementsByTagName('A') | where-object {$_.innerText -eq 'Click here'}
$link.click()
回答2:
Its works
while($ie.busy) {sleep 5}
$dmeContExpFrame = $ie.Document.getElementById("portfolio_frameset")
$dmecontexpframedoc = $dmeContExpFrame.contentWindow
$dmeContExpFramedoc2 = $dmecontexpframedoc.Document
$click = $dmeContExpFramedoc2.getElementsByTagName("b") | ?{$_.innerText -Match "Monitor Library"}
$click.click()