Click a hyperlink using powershell

I need to click a hyperlink in an aspx web form using powershell. How can i achieve this? Also this link shows a drop down menu, and I have to choose the right one from this link.

+3
source share
3 answers
$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()
+6
source

Work

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()
0
source

- ! , , , onclick, System.__ ComObject ( ). , . onclick: System.__ ComObject img $ _. Outerhtml. , ... bold , , .

$ dmeContExpFramedoc2.getElementsByTagName("img")) | where-object {$ _. externalhtml -match "hc_Add"}

className:

id: hc_Add

tagName: IMG

parentElement: System.__ ComObject

: System.__ ComObject

onhelp:

onclick: System.__ ComObject

ondblclick:

onkeydown:

onkeyup:

onkeypress:

onmouseout: System.__ ComObject

onmouseover: System.__ ComObject

onmousemove:

onmousedown:

onmouseup:

document: mshtml.HTMLDocumentClass

:

:

onselectstart:

sourceIndex: 124

:

lang:

offsetTop: 1

offsetWidth: 20

offsetHeight: 20

offsetParent: System.__ ComObject

innerHTML:

innerText:

externalHTML: IMG onclick = "javascript: JDEDTAFactory.getInstance(''). post ('0_21')" onmouseover = "this.src= '/jde/img/hc_Addmo.gif'" onmouseout = "this.src= '/jde/img/hc_Add.gif '"id = hc_Add style =" CURSOR: pointer; VERTICAL-ALIGN: middle "border = 0 name = hc_Add alt=" (Ctrl + Alt + A) "src="/jde/img/hc_Add.gif"

externalText:

parentTextEdit: System.__ ComObject

isTextEdit: False

: System.__ ComObject

0

Source: https://habr.com/ru/post/1763292/


All Articles