New-Object -com InternetExplorer.Application

by Aug 9, 2014

 

 

 

Unable to click link

using  windows 8.1 and IE 11 and powershell .  

problem is that I can't click the link

any help would be help full

 

found this example online this is the same a i have ……………. but simpler   

 

if this works it will help

 

 

$URL = "https://google.co.uk"

$ie = New-Object -com InternetExplorer.Application

$ie.visible=$true

$ie.navigate($URL) 

while($ie.ReadyState -ne 4) {start-sleep -m 100}

$ie.Document.getElementById("A").click()

$yt = $links | where {$_.innerText -eq 'YouTube'}

$yt.click()

 

will this work on your machine?

 

error 

You cannot call a method on a null-valued expression.

At C:UserssteDocumentsA POWERSHELLUntitled70.ps1:9 char:1

+ $yt.click()

+ ~~~~~~~~~~~

    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException

    + FullyQualifiedErrorId : InvokeMethodOnNull