Open Web Page Click button close

I am trying to open a web page and click on a button on the page…. repeat.

I have it able to open and close a web page but i can not figure out how to make it click on a button on the page. I am using google as an example.

while ($true)


$oIE = New-Object -ComObject internetexplorer.application;


$oIE.Visible = $true #…or false, if you what it appear on the desktop, or not

start-sleep -seconds 20 #keeps IE open for 20 seconds

$link = $ie.Document.getElementsByTagName(‘button’) | where {$_.textContent -eq ‘Maps’}



Get-Process iexplore | Foreach-Object { $_.CloseMainWindow() } #closes IE window


That is the code i’m working with. any help would be great thanks.

submitted by /u/bcav311
[link] [comments]

Leave a Reply