![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | innerHTML method not working Hi, When trying the following piece of code: $oIE=New-object -COM InternetExplorer.Application $oIE.navigate2("about:blank") $oIE.Visible=$True $html="<html><head></head><body>Hello World!</body></html>" $oIE.document.body.innerHTML=$html I am getting the following error: Property 'innerHTML:' cannot be found on this object; make sure it exists and is settable. Any idea what is going wrong? I am using Microsoft IE 6.0.2900 and Windows PowerShell RC1 Thanks. |
My System Specs![]() |
| | #2 (permalink) |
| | RE: innerHTML method not working This should do what you want. If last line fails, try the one that is commented out instead. Hope that helps. $oIE = New-Object -COM InternetExplorer.Application $oIE.navigate("about:blank") while ($oIE.busy) { sleep 1 } $oIE.visible = $true $html="<html><head></head><body>Hello World!</body></html>" $oIE.document.IHTMLDocument2_write("$html") #$oIE.document.write("$html") -- greetings dreeschkind "Anonymous" wrote: > Hi, > > When trying the following piece of code: > > $oIE=New-object -COM InternetExplorer.Application > $oIE.navigate2("about:blank") > $oIE.Visible=$True > $html="<html><head></head><body>Hello World!</body></html>" > $oIE.document.body.innerHTML=$html > > I am getting the following error: > Property 'innerHTML:' cannot be found on this object; make sure it exists > and is settable. > > Any idea what is going wrong? I am using Microsoft IE 6.0.2900 and Windows > PowerShell RC1 > > Thanks. > |
My System Specs![]() |
| | #3 (permalink) |
| | RE: innerHTML method not working Thanks ! What if I want to read (and save) the entire contents of the html page? How would I do that? "dreeschkind" wrote: > This should do what you want. If last line fails, try the one that is > commented out instead. Hope that helps. > > $oIE = New-Object -COM InternetExplorer.Application > $oIE.navigate("about:blank") > while ($oIE.busy) { sleep 1 } > $oIE.visible = $true > $html="<html><head></head><body>Hello World!</body></html>" > $oIE.document.IHTMLDocument2_write("$html") > #$oIE.document.write("$html") > > -- > greetings > dreeschkind > > "Anonymous" wrote: > > > Hi, > > > > When trying the following piece of code: > > > > $oIE=New-object -COM InternetExplorer.Application > > $oIE.navigate2("about:blank") > > $oIE.Visible=$True > > $html="<html><head></head><body>Hello World!</body></html>" > > $oIE.document.body.innerHTML=$html > > > > I am getting the following error: > > Property 'innerHTML:' cannot be found on this object; make sure it exists > > and is settable. > > > > Any idea what is going wrong? I am using Microsoft IE 6.0.2900 and Windows > > PowerShell RC1 > > > > Thanks. > > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: innerHTML method not working What version of IE and of PowerShell are you using? I'm having some issues of my own with IE 7 beta. On a Win2003SP1 system running IE 6 and PS RC1, however, I can run your code with no problems. By the way, if you echo the innerHtml successfully you may think it was mangled; it's not. The html/head/body tags are not part of the body's innerHTML. Here's what I get on the Win2003SP1+PSRC1 system: $ie=New-Object -ComObject InternetExplorer.Application $ie.navigate2("http://www.google.com") $ie.Visible = $true PS> $html="<html><body><bold>Hello World!</bold></body></html>" PS> $ie.document.body.innerHTML = $html PS> $ie.document.body.innerHTML <BOLD>Hello World!</BOLD> "Anonymous" <Anonymous@discussions.microsoft.com> wrote in message news:9F20EA0F-CFA6-4A2D-84E2-AFFC1B90779D@microsoft.com... > Hi, > > When trying the following piece of code: > > $oIE=New-object -COM InternetExplorer.Application > $oIE.navigate2("about:blank") > $oIE.Visible=$True > $html="<html><head></head><body>Hello World!</body></html>" > $oIE.document.body.innerHTML=$html > > I am getting the following error: > Property 'innerHTML:' cannot be found on this object; make sure it exists > and is settable. > > Any idea what is going wrong? I am using Microsoft IE 6.0.2900 and Windows > PowerShell RC1 > > Thanks. > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Resync method | .NET General | |||
| InnerHTML not working | VB Script | |||
| method not many | Vista mail | |||
| Method invocation failed because [System.String] doesn't contain a method | PowerShell | |||
| Wmi put() method - what am i doing wrong ? | PowerShell | |||