Sign in to follow this  
Followers 0
Viktor

How to refer to a form which does not have a name or ID ?

3 posts in this topic

I want to fill a form on a company website (not on the internet). Unfortunately I cannot see the name of the form at all... This is my code:

CODE
$oIE = _IECreate ("http://blablalallalalal//index.cfm?fuseaction=lib.ic_requests")

$oForm = _IEGetObjByName ($oIE, "lib.ic_submitform")

_IEFormElementRadioSelect ($oForm, "EW", "theSite", 1, "byValue")

This is how the form element look like in the source:

CODE
<FORM onsubmit="return isMailReady(this);"

action=index.cfm?fuseaction=lib.ic_submitform method=post><INPUT

type=hidden value=NO name=Urgent> <INPUT class=biginput

type=hidden value=1 name=copies>

<TBODY>

<TR>

<TD colSpan=4>

<DIV>Items in <SPAN class=subheader>red</SPAN> are required to

effectively process and deliver your request. </DIV><BR>

<DIV>If you have any questions, corrections, or deletions to

make on a previous request, or if this is an extremely urgent

request, please call the Information Centre directly on

Anyone has an idea how to set that radio button if I cannot refer to the form object?

Thanks: V.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I would suggest you to install IE developer toolbar from Miscrosoft to have a full view of the DOM. It will show other element properties that quite likely will uniquely identify the element you are looking for, for instace the "source index" property (make sure you check the "show read-only properties" in the IE Web Developer Toolbar)

Then you could do something like this (not tested!):

$objINPUTtags = _IETagNameGetCollection($objIE, "INPUT")
For $objINPUTtag In $objINPUTtags
    If $objINPUTtag.sourceIndex = _your_source_index_here_ Then
        _IEAction ( $objINPUTtag, "click")      
    EndIf
Next
Edited by TunaSalad

Why crabs don't give money to charity..... because they are shell-fish!! PS: Don't be a crab and share your scripts with the community! ;-)

Share this post


Link to post
Share on other sites

Thank you very much!!!!!!!!!!!!!!!!!! It worked very well! I was also able to use the same concept to fill a text field which is what my goal was, but the text fiels will only be visible when the radio button is set!

Thanks Again! :) Viktor

I would suggest you to install IE developer toolbar from Miscrosoft to have a full view of the DOM. It will show other element properties that quite likely will uniquely identify the element you are looking for, for instace the "source index" property (make sure you check the "show read-only properties" in the IE Web Developer Toolbar)

Then you could do something like this (not tested!):

$objINPUTtags = _IETagNameGetCollection($objIE, "INPUT")
For $objINPUTtag In $objINPUTtags
    If $objINPUTtag.sourceIndex = _your_source_index_here_ Then
        _IEAction ( $objINPUTtag, "click")      
    EndIf
Next

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0