I am writing several Internet Explorer automation scripts using PowerShell. This is how I run the IE com object:
$ie = New-Object -com "InternetExplorer.Application"
$ie.Navigate("about:blank")
$ie.visible = $true
$doc = $ie.Document
So, I would like to do to execute some javascript in the $ doc object. For example, I have an element on the page with the onclick event that executes "submitCommand ('lookup')", so I would like to run this directly in $ doc instead of finding the object on the page and then calling the Click () method.
It would be simpler because the object does not have a name or identifier, therefore it is very important to change it, since I can only rely on its position on the page (for example, the 11th span element on the page).
Alternatively, how would you choose elements based on their class? This will help a lot since the "button" has its own class.
thanks
source
share