I’m trying to learn how to work with IE DOM objects such as buttons and text area in powershell. What I’m trying to do is enter value in the input, and click the button from this website https://www.aviationweather.gov/adds/
This is what I have so far, but I’m getting errors. The elementid of the input is “autocomplete”, and the id for button is “btnsearch”.
It will show you that you have a click() method.
So we can use that to invoke our click-event.
Now notice that i have a while{} included. This is because without it, you would invoke the click event before the page is fully loaded. This would end up not working and throwing you an error-message.
If you ever have worked with Javascript , or with a framework like Jquery, you would go like:
$(document).ready(function(){ /* .click fucntion over here. */ });
This would wait until the page had loaded before triggering the Click-event.
If you don’t work with the new-object but with Invoke-webrequest, you don’t have this issue.
I don’t know why that is, i figure it probably has a build in wait function.