Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Trouble setting form value with IE COM Object

950 views
Skip to first unread message

Henson Sturgill

unread,
Sep 4, 2009, 12:43:01 AM9/4/09
to
I'm trying to write a small script to login to the mobile Facebook site so
that I can mine the contact information from my friends (Facebook doesn't
have an export.) Unfortunately, whenever I run this script I get the error:

"Property 'value' cannot be found on this object; make sure it exists and is
settable.
At C:\Users\BigEyedDad\Documents\fbContacts.ps1:16 char:8
+ $email. <<<< value = "test""

Here's what I've got so far:

-------[ CODE ]-------

$ie = New-Object -COM InternetExplorer.Application
$ie.navigate("http://m.facebook.com")
$ie.visible = $true

start-sleep 5

#grab form elements for login
$email = $ie.document.getElementsByName("email")
$pass = $ie.document.getElementsByName("pass")
$button = $ie.document.getElementsByName("login")

start-sleep 1

#set values
$email.value = "test"

-------[ END CODE ]-------

Marco Shaw [MVP]

unread,
Sep 4, 2009, 10:11:13 PM9/4/09
to
I haven't checked your post in any detail, but this might help:
http://scriptolog.blogspot.com/2007/01/automated-web-forms.html

Marco

"Henson Sturgill" <HensonS...@discussions.microsoft.com> wrote in
message news:28731049-AD9C-4313...@microsoft.com...

richardforth

unread,
Apr 28, 2010, 12:35:49 PM4/28/10
to
I am having a similar problem with our in house web-based call logging system, I am trying to automate the process of filling out the same fields over and over again I beleive the problem is due to the elements you are trying to attach to are set in a frameset.

I have proved this by connecting directly to the source page for the frame with the script and it fills out oall the fields no problems, when i try it within the frameset i get the error:

Property 'value' cannot be found on this object; make sure it exists and is settable.

I need to somehow get the equivalent of somethign liek frameset.child.getelementsbyname("name")

but I dont know how to acheive this. if I get a resolution I'll keep you posted.

Marco Shaw [MVP] wrote:

I have not checked your post in any detail, but this might
04-Sep-09

I have not checked your post in any detail, but this might help:
http://scriptolog.blogspot.com/2007/01/automated-web-forms.html

Marco

Previous Posts In This Thread:

On Friday, September 04, 2009 12:43 AM
Henson Sturgill wrote:

Trouble setting form value with IE COM Object
I am trying to write a small script to login to the mobile Facebook site so
that I can mine the contact information from my friends (Facebook does not


have an export.) Unfortunately, whenever I run this script I get the error:

"Property 'value' cannot be found on this object; make sure it exists and is
settable.
At C:\Users\BigEyedDad\Documents\fbContacts.ps1:16 char:8
+ $email. <<<< value = "test""

Here is what I have got so far:

-------[ CODE ]-------

$ie = New-Object -COM InternetExplorer.Application
$ie.navigate("http://m.facebook.com")
$ie.visible = $true

start-sleep 5

$email = $ie.document.getElementsByName("email")


$pass = $ie.document.getElementsByName("pass")
$button = $ie.document.getElementsByName("login")

start-sleep 1

$email.value = "test"

-------[ END CODE ]-------

On Friday, September 04, 2009 10:11 PM
Marco Shaw [MVP] wrote:

I have not checked your post in any detail, but this might
I have not checked your post in any detail, but this might help:
http://scriptolog.blogspot.com/2007/01/automated-web-forms.html

Marco


Submitted via EggHeadCafe - Software Developer Portal of Choice
WPF GridView Sample To Insert, Update, and Delete Records
http://www.eggheadcafe.com/tutorials/aspnet/fc9a5bf6-f5bb-4443-a92a-c9a46fd3aeb2/wpf-gridview-sample-to-in.aspx

richardforth

unread,
Apr 28, 2010, 12:43:00 PM4/28/10
to
frameset dom object problem
Richard Forth replied to Marco Shaw [MVP] on Wednesday, April 28, 2010 12:35 PM


I am having a similar problem with our in house
web-based call logging system, I am trying to
automate the process of filling out the same
fields over and over again I beleive the problem
is due to the elements you are trying to attach
to are set in a frameset.

I have proved this by connecting directly to the
source page for the frame with the script and it

fills out all the fields no problems, when i try
it within the frameset i get the error:

Property 'value' cannot be found on this object;
make sure it exists and is settable.

I need to somehow get the equivalent of something
like frameset.child.getelementsbyname("name")


but I dont know how to acheive this.

if I get a resolution I'll keep you posted.


Henson Sturgill wrote:

Trouble setting form value with IE COM Object

04-Sep-09

I am trying to write a small script to login to the mobile Facebook site so
that I can mine the contact information from my friends (Facebook does not


have an export.) Unfortunately, whenever I run this script I get the error:

"Property 'value' cannot be found on this object; make sure it exists and is
settable.
At C:\Users\BigEyedDad\Documents\fbContacts.ps1:16 char:8
+ $email. <<<< value = "test""

Here is what I have got so far:

-------[ CODE ]-------

$ie = New-Object -COM InternetExplorer.Application
$ie.navigate("http://m.facebook.com")
$ie.visible = $true

start-sleep 5

$email = $ie.document.getElementsByName("email")


$pass = $ie.document.getElementsByName("pass")
$button = $ie.document.getElementsByName("login")

start-sleep 1

$email.value = "test"

-------[ END CODE ]-------

Previous Posts In This Thread:

On Friday, September 04, 2009 12:43 AM
Henson Sturgill wrote:

Trouble setting form value with IE COM Object

I am trying to write a small script to login to the mobile Facebook site so
that I can mine the contact information from my friends (Facebook does not


have an export.) Unfortunately, whenever I run this script I get the error:

"Property 'value' cannot be found on this object; make sure it exists and is
settable.
At C:\Users\BigEyedDad\Documents\fbContacts.ps1:16 char:8
+ $email. <<<< value = "test""

Here is what I have got so far:

-------[ CODE ]-------

$ie = New-Object -COM InternetExplorer.Application
$ie.navigate("http://m.facebook.com")
$ie.visible = $true

start-sleep 5

$email = $ie.document.getElementsByName("email")


$pass = $ie.document.getElementsByName("pass")
$button = $ie.document.getElementsByName("login")

start-sleep 1

$email.value = "test"

-------[ END CODE ]-------

On Friday, September 04, 2009 10:11 PM
Marco Shaw [MVP] wrote:

I have not checked your post in any detail, but this might
I have not checked your post in any detail, but this might help:
http://scriptolog.blogspot.com/2007/01/automated-web-forms.html

Marco

On Wednesday, April 28, 2010 12:35 PM
Richard Forth wrote:

frameset dom object problem


I am having a similar problem with our in house web-based call logging system, I am trying to automate the process of filling out the same fields over and over again I beleive the problem is due to the elements you are trying to attach to are set in a frameset.

I have proved this by connecting directly to the source page for the frame with the script and it fills out oall the fields no problems, when i try it within the frameset i get the error:

Property 'value' cannot be found on this object; make sure it exists and is settable.

I need to somehow get the equivalent of somethign liek frameset.child.getelementsbyname("name")

but I dont know how to acheive this. if I get a resolution I'll keep you posted.

Submitted via EggHeadCafe - Software Developer Portal of Choice

WPF Report Engine, Part 4
http://www.eggheadcafe.com/tutorials/aspnet/5ac799db-385f-431a-8a45-8b37cb7f3186/wpf-report-engine-part-4.aspx

richardforth

unread,
Apr 28, 2010, 12:43:12 PM4/28/10
to
frameset dom object problem
Richard Forth replied to Marco Shaw [MVP] on Wednesday, April 28, 2010 12:35 PM


I am having a similar problem with our in house
web-based call logging system, I am trying to
automate the process of filling out the same
fields over and over again I beleive the problem
is due to the elements you are trying to attach
to are set in a frameset.

I have proved this by connecting directly to the
source page for the frame with the script and it
fills out all the fields no problems, when i try

it within the frameset i get the error:

Property 'value' cannot be found on this object;
make sure it exists and is settable.

I need to somehow get the equivalent of something


like frameset.child.getelementsbyname("name")
but I dont know how to acheive this.

if I get a resolution I'll keep you posted.


Henson Sturgill wrote:

Trouble setting form value with IE COM Object
04-Sep-09

I am trying to write a small script to login to the mobile Facebook site so
that I can mine the contact information from my friends (Facebook does not


have an export.) Unfortunately, whenever I run this script I get the error:

"Property 'value' cannot be found on this object; make sure it exists and is
settable.
At C:\Users\BigEyedDad\Documents\fbContacts.ps1:16 char:8
+ $email. <<<< value = "test""

Here is what I have got so far:

-------[ CODE ]-------

$ie = New-Object -COM InternetExplorer.Application
$ie.navigate("http://m.facebook.com")
$ie.visible = $true

start-sleep 5

$email = $ie.document.getElementsByName("email")


$pass = $ie.document.getElementsByName("pass")
$button = $ie.document.getElementsByName("login")

start-sleep 1

$email.value = "test"

-------[ END CODE ]-------

Previous Posts In This Thread:

On Friday, September 04, 2009 12:43 AM
Henson Sturgill wrote:

Trouble setting form value with IE COM Object

I am trying to write a small script to login to the mobile Facebook site so
that I can mine the contact information from my friends (Facebook does not


have an export.) Unfortunately, whenever I run this script I get the error:

"Property 'value' cannot be found on this object; make sure it exists and is
settable.
At C:\Users\BigEyedDad\Documents\fbContacts.ps1:16 char:8
+ $email. <<<< value = "test""

Here is what I have got so far:

-------[ CODE ]-------

$ie = New-Object -COM InternetExplorer.Application
$ie.navigate("http://m.facebook.com")
$ie.visible = $true

start-sleep 5

$email = $ie.document.getElementsByName("email")


$pass = $ie.document.getElementsByName("pass")
$button = $ie.document.getElementsByName("login")

start-sleep 1

$email.value = "test"

-------[ END CODE ]-------

On Friday, September 04, 2009 10:11 PM
Marco Shaw [MVP] wrote:

I have not checked your post in any detail, but this might
I have not checked your post in any detail, but this might help:
http://scriptolog.blogspot.com/2007/01/automated-web-forms.html

Marco

On Wednesday, April 28, 2010 12:35 PM
Richard Forth wrote:

frameset dom object problem
I am having a similar problem with our in house web-based call logging system, I am trying to automate the process of filling out the same fields over and over again I beleive the problem is due to the elements you are trying to attach to are set in a frameset.

I have proved this by connecting directly to the source page for the frame with the script and it fills out oall the fields no problems, when i try it within the frameset i get the error:

Property 'value' cannot be found on this object; make sure it exists and is settable.

I need to somehow get the equivalent of somethign liek frameset.child.getelementsbyname("name")

but I dont know how to acheive this. if I get a resolution I'll keep you posted.

On Wednesday, April 28, 2010 12:42 PM
Richard Forth wrote:

COM Object problem powershell / frames


frameset dom object problem
Richard Forth replied to Marco Shaw [MVP] on Wednesday, April 28, 2010 12:35 PM


I am having a similar problem with our in house
web-based call logging system, I am trying to
automate the process of filling out the same
fields over and over again I beleive the problem
is due to the elements you are trying to attach
to are set in a frameset.

I have proved this by connecting directly to the
source page for the frame with the script and it
fills out all the fields no problems, when i try

it within the frameset i get the error:

Property 'value' cannot be found on this object;
make sure it exists and is settable.

I need to somehow get the equivalent of something


like frameset.child.getelementsbyname("name")
but I dont know how to acheive this.

if I get a resolution I'll keep you posted.

Submitted via EggHeadCafe - Software Developer Portal of Choice

Server Side Processing in ADO.NET/WCF Data Services
http://www.eggheadcafe.com/tutorials/aspnet/db179aed-47fa-4f86-a4bf-4f6f92a76585/server-side-processing-in.aspx

X22degg5

unread,
May 9, 2010, 3:51:59 PM5/9/10
to
'I had this problem with frames in vbscript. There is a "frames"
colleciton, something like this. I made the arbitrary assumption that the
frame with the most elements was the frame I wanted to fill out the form in.

Set oDoc = objDoc.Document
hhh = oDoc.GetElementsByTagName("Frame").length
for ggg = 0 to hhh - 1
BiggestFrame1 =
oDoc.frames(ggg).document.getElementsByTagName("*").length
If BiggestFrame < BiggestFrame1 then
BiggestFrame = Biggestframe1
LLLL = ggg
End If
next
'then something like:

FFFFF = odoc.frames(LLLL).document.getElementsByTagName("input").length
for FFctr = 0 to FFFFF -1
'msgbox
odoc.frames(LLLL).document.getElementsByTagName("input").item(FFctr).name
If
odoc.frames(LLLL).document.getElementsByTagName("input").item(FFctr).name =
"Some name" then
odoc.frames(LLLL).document.getElementsByTagName("input").item(FFctr).value
= param
exit for
End If
next

' I am way too new to powershell to convert vbscript to powershell, but, I
found that the frames get addressed as an array. I wound up hardcoding the
array number:
If odoc.frames(2).document.getElementsByTagName("input").item(FFctr).name =
"somename" then
---------
<Richard Forth> wrote in message
news:2010428124259...@gmail.com...


> frameset dom object problem
> Richard Forth replied to Marco Shaw [MVP] on Wednesday, April 28, 2010
> 12:35 PM
>

rawrr

unread,
Feb 4, 2013, 2:07:36 PM2/4/13
to
Try using getElementById, currently you are retrieving an array which is why .value would be null.
0 new messages