views:

40

answers:

1

Hi

i need to click on a hyperlink in a aspx webform using powershell how can i achieve it. also that link shows a drop down menu and i have to select right option from that link.

thanks

+3  A: 
$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()
Shay Levy
Thanks your help i had to use following lines to access frame's content. $dmeContExpFrame = $ie.Document.getElementById("ContentFrame")$dmecontexpframedoc = $dmeContExpFrame.contentWindow$dmeContExpFramedoc2 = $dmecontexpframedoc.Document$links = $dmeContExpFramedoc2.getElementsByTagName('A')$links | select innerText