It seems that the data from the page does not reach me, it opens, but it tells me that the value is null.
I have tried with id
and neither, I am in version 5.1 of power shell.
This is the code:
clear-host
$ie = new-object -com "InternetExplorer.Application"
$ie.navigate2("https://www.youtube.com/?hl=es&gl=ES")
$ie.visible = $true
$ie.Document.getElementsByTagName("input").value = "asdf"
And this is the error:
The requirement of your request has not been very clear, but from what I understood you are mixing 2 issues:
One is being able to open a browser at a certain URL and the other is being able to complete an entry within a URL.
If what you want is to be able to open a browser with a YouTube search, one way to do it is as follows:
Where the search variable specifies the value to search for. If you look at the second line, I used the Replace method since when searching with terms that contain spaces, they are replaced with plus signs (+).
The result of the above should open a new IE window with the Youtube search for the term "powershell".
Edited:
With your comment, I did a bit of checking and was able to come up with this:
Added a wait while the page loads, then if filtering the search field and the search button. With the above you should be able to do what you have in mind.