$ie.visible = $false

I use the following to assign text and search ok if set $ie.visible = $true. But the text cannot be assigned if set $ie.visible = $false. The text box is still empty after run $ie.Document.getElementById('TextBox_ID') = 'This is'.   Is there a way to fix it? Thank

$ie = New-Object -COM "InternetExplorer.Application"
$ie.visible = $true
$ie.Navigate('http://searchtext.com')
While  ($ie.busy) { Start-Sleep -Seconds 1 }
$ie.Document.getElementById('TextBox_ID') = 'This is'
$ie.Document.getElementById('Search_ID').click()

February 21st, 2015 4:40am

What?  You are asking a very impossible question.

Most of you lines of code are nonsense.  Do you have any experience in scripting?  Have you ever written a script?

Start by learning the basics of scripting then post back with a rational question.

Free Windows Admin Tool Kit Click here and download it now
February 21st, 2015 5:54am

which lines are wrong? Those were copied from my working script. The only changes made are url and IDs.

You may read these as some script other than Powershell.

February 21st, 2015 7:26am

What is this line supposed to do" "ie.Document.getElementById('TextBox_ID') = 'This is'"

An ID cannot have a space in it.

You cannot directly assign a value in that way.  You need to assign the value member.

A web page that I not vivible can very easily not behave as expected.  It all depends on the design of the web page.

if($tb=$ie.Document.getElementById('TextBox_ID')){
    $tb.Value='This is the new value' 
}else{
    # textbox not found
}

Free Windows Admin Tool Kit Click here and download it now
February 21st, 2015 12:16pm

I checked my code, it is $ie.Document.getElementById('TextBox_ID').value = 'This is'

You know what I mean.  Do you have advice how to resolve it?


  • Edited by Ian3 Saturday, February 21, 2015 2:48 PM
February 21st, 2015 4:02pm

You would have to ask the web site developer.
Free Windows Admin Tool Kit Click here and download it now
February 21st, 2015 4:06pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics