Write to a textbox by html id

Jul 23, 2013 at 4:39 PM
Edited Jul 24, 2013 at 4:56 PM
Hello, I was wondering if you would be able to assist me in how to write text to an html webpage textbox using a line in windows powershell. I am able to do this by writing in notepad, but i am trying to automate a login process to a webpage and would like to select the textbox by its html id tag. Thank you!
Coordinator
Aug 10, 2013 at 7:14 PM
Windows automation can't, in general, see the html tags. You need to get into web automation directly for that (my suggestion would be selenium there's an interesting "port" to PowerShell here on CodePlex (I haven't tried it yet, but it looks : https://sepsx.codeplex.com/
Oct 23, 2013 at 10:47 AM
Edited Oct 23, 2013 at 10:47 AM
If you use Internet Explorer Automation interface, it is possible, but I never tried with any other Browser's API. Here is Powershell method:
$ie = New-Object -ComObject "InternetExplorer.Application"
$ie.Visible=1
$ie.Navigate("C:\MyPage.htm")
$txtArea=$ie.Document.getElementById("MyTextBox") #assuming that your TextBox Id is 'MyTextBox'

$txtArea.InnerText="Hello world"

$txtArea.Value="My Value"
Hope this helps