Jump to content

How to get the form object in web page.i.e each webpage has different tabs.


rodex
 Share

Recommended Posts

See _IEAttach and _IEForm*

If you want a better answer, provide (a lot) more information.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

See _IEAttach and _IEForm*

If you want a better answer, provide (a lot) more information.

Dale

Hi Dale.

Thank you for spending your time.

In my web application , once you login and when you click on menu option , it will open a new tab in application and loads corresponding page in tab(it is simillar to one IE with multiple tabs.). please note that it does not open a new tab in IE.tabs will be crated in application page.

i'm looking for a way to refer the objects in html pages , those loaded in different tabs.

Thanks.

Link to comment
Share on other sites

So again, not much to go on, but look at _IEAttach and _IEForm* functions.

_IEAttach in the latest beta gives you a lot more control with the "embedded" option that you may need in this scenario.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

So again, not much to go on, but look at _IEAttach and _IEForm* functions.

_IEAttach in the latest beta gives you a lot more control with the "embedded" option that you may need in this scenario.

Dale

Dale thank you so much for your valuable suggestions.

i tried with above options, but i could not solve the issue.

below is the my script..

---------------------------------

$oIE = _IECreate("http://ttasdv.app.com",0,1,1,0)

sleep(500)

Send("testuser{TAB}")

sleep(20)

Send("paswd{ENTER}")

;sleep(1000)

_IELoadWait ($oIE)

WinSetState("", "", @SW_MAXIMIZE)

$divId = _IEGetObjById ($oIE, "tabs")

;$TsecCon_Form = _IEFormGetObjByName ($divId, "SecContainerForm")

ConsoleWrite(_IEDocReadHTML($divId) & @CR)

----------------------------------------------------------

once i login to application.. basically i need to access the list values

List is embedded in the in the web page like below...

outer html has a div tag.with in div area there are iframes.In the iframe we are displaying HTML page(which has combo box) .. but unfortunately iframes have no names. can you please advise the way to get the list box reference... thanks..

HTML Page

DIV ( ID = tabs).

IFRAME ( has no name)

HTML

FORM - (name = "container name"

LIST BOX(name = "container box"

Edited by rodex
Link to comment
Share on other sites

Well, I don't quite understand what problem your having, but it sounds as if you should try a sort of _IEFormGetCollection or _IEFormElementGetCollection. Form what I understood your trying to use the LIST BOX right? So if the LIST BOX is in the form than you should be able to get it. I'm not sure what to do about the tab though, can't you just have it select that next tab, or not even bother with selecting it? Never really messed with that. Sorry.

Look at _IEFormGetCollection and _IEFormElementGetCollection. Sorry if it didn't help, I didn't really understand what the problem totally is. You may also want to look at _IEAction.

Edited by uPod
Link to comment
Share on other sites

Well, I don't quite understand what problem your having, but it sounds as if you should try a sort of _IEFormGetCollection or _IEFormElementGetCollection. Form what I understood your trying to use the LIST BOX right? So if the LIST BOX is in the form than you should be able to get it. I'm not sure what to do about the tab though, can't you just have it select that next tab, or not even bother with selecting it? Never really messed with that. Sorry.

Look at _IEFormGetCollection and _IEFormElementGetCollection. Sorry if it didn't help, I didn't really understand what the problem totally is. You may also want to look at _IEAction.

thank you for helping me on this issue.

here i want to select the values in the list box and click on button.

As you see structure of my webpage. . the web page having list box is embedded in other html page as shoen below.

HTML Page ->DIV ( ID = tabs) ->IFRAME ( has no name) -> HTML->FORM - (name = "container name" ->LIST BOX(name = "container box"

whenever i try to access the form it is always pointing to outer html page,which has no forms,hence result is returning 0 list.

i'm thinking that first i need to get the reference to inner html page which loaded in iframe(has no name) ,which in turn placed in <DIV id = 'tabs'> tag.

i tried below options

tried with _IEATTACH() by passing search text and embeded options.

and tried with _IENAVIGATE() , which didn't wok, it is distrubing flow, i don't want to distrub existing window.

and tries with directly accessing form by name - no result

please let me know if i missed here anything..

Link to comment
Share on other sites

The messages sent to the SciTe console when you run your code are critical. If you hope to get any further assistance from me, you'll need to include code and the SciTe console messages that go with it.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

The messages sent to the SciTe console when you run your code are critical. If you hope to get any further assistance from me, you'll need to include code and the SciTe console messages that go with it.

Dale

Dale, please refer the below code..

#AutoIt3Wrapper_UseAnsi=y

#AutoIt3Wrapper_run_debug_mode=Y

#include <IE.au3>

$oIE = _IECreate("http://tctc.com:4444/WebLogin",0,1,1,0)

sleep(500)

Send("testuser{TAB}")

sleep(20)

Send("pass{ENTER}")

;sleep(1000)

_IELoadWait ($oIE)

WinSetState("", "", @SW_MAXIMIZE)

$divId = _IEGetObjById ($oIE, "tabs")

$TsecCon_Form = _IEFormGetObjByName ($divId, "SecContainerForm")

;ConsoleWrite(_IEDocReadHTML($divId) & @CR)

-------------------

SciTe console messages

!> Starting in DebugMode..

Line: @error-@extended: Line syntax

0001: 0-0: #AutoIt3Wrapper_UseAnsi=y

0002: 0-0: #AutoIt3Wrapper_run_debug_mode=Y

0003: 0-0: #include <IE.au3>

0004: 0-0: $oIE = _IECreate("http://tctc.com:4444/WebLogin",0,1,1,0)

0005: 0-0: sleep(500)

0006: 0-0: Send("testuser{TAB}")

0007: 0-0: sleep(20)

0008: 0-0: Send("pass{ENTER}")

0010: 0-0: _IELoadWait ($oIE)

0011: 0-0: WinSetState("", "", @SW_MAXIMIZE)

0012: 0-0: $divId = _IEGetObjById ($oIE, "tabs")

0013: 0-0: $TsecCon_Form = _IEFormGetObjByName ($divId, "SecContainerForm")

--> IE.au3 V2.3-1 Warning from function _IEFormGetObjByName, $_IEStatus_NoMatch

Edited by rodex
Link to comment
Share on other sites

Since I can't get to that URL and a big part of your script uses blind SENDs instead of _IE functions, you havn't given enough to work with to help.

Did you look at the _IEForm* functions? I also suggest you get DebugBar and see if it can help you (see my sig).

What kind of an element has the ID of "tabs"?

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Yes Dale.first i tried to call directly call _IEFormGetObjByName ($divId, "SecContainerForm") but it is returning null.

I tracked the Webpage structure by using dubugger .Form was embedded in <html> <body> <div name = "tab"s> <iframe> <html><body> < form name = "SecContainerForm">

Hence i could not access the form directly,i'm trying to firs access the div tag then form.

Please let me know if i'm doing anything wrong here.

Link to comment
Share on other sites

<iframe>

Frames and iFrames are document containers (like the top level browser). If there is an iFrame involved, you need to use of the _IEFrame* functions to get a reference to it and then use that reference in place of the $oIE you see in all of the _IE function examples. Please look at the examples for the _IEFrame* functions and download (the free) DebugBar and you should make a lot more progress.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Hi Dale,

i tracked through debugger, total 6 iframes in mypage.i'm trying to access the list biox , which is in HTML Page ->DIV ( ID = tabs) ->IFRAME ( id = "cifa") -> HTML->FORM - (name = "container name" ->LIST BOX

please refr the attched screenshot for more information

when i run the below example it is giving below error.please see the below scite console log

#AutoIt3Wrapper_UseAnsi=y

#AutoIt3Wrapper_run_debug_mode=Y

#include <IE.au3>

;$oIE = _IECreate("http://ttdvd15.ebiz.verizon.com:4444/vnmWeb",0,1,1,0)

$oIE = _IECreate("http://136.151.39.149:7001/vnmWeb",0,1,1,0)

sleep(500)

Send("testuser{TAB}")

sleep(20)

Send("pass{ENTER}")

;sleep(1000)

_IELoadWait ($oIE)

WinSetState("", "", @SW_MAXIMIZE)

;$oElements = _IETagNameAllGetCollection ($oIE)

;$divId = _IEGetObjById ($oIE, "tabs")

$oFrames = _IEFrameGetCollection ($oIE)

$iNumFrames = @extended

MsgBox(0, "Noo of Frames",$iNumFrames)

For $i = 0 to ($iNumFrames - 1)

$oFrame = _IEFrameGetCollection ($oIE, $i)

;MsgBox(0, "Frame Info", _IEPropertyGet ($oFrame, "src"))

MsgBox(0, "Frame Info", _IEPropertyGet ($oFrame, "locationurl"))

Next

;ConsoleWrite(_IEDocReadHTML($oIE) & @CR)

-------------

console log

0002: 0-0: #AutoIt3Wrapper_run_debug_mode=Y

0003: 0-0: #include <IE.au3>

0005: 0-0: $oIE = _IECreate("http://136.151.39.149:7001/vnmWeb",0,1,1,0)

0006: 0-0: sleep(500)

0007: 0-0: Send("testuser{TAB}")

0008: 0-0: sleep(20)

0009: 0-0: Send("pass{ENTER}")

0011: 0-0: _IELoadWait ($oIE)

0012: 0-0: WinSetState("", "", @SW_MAXIMIZE)

0015: 0-0: $oFrames = _IEFrameGetCollection ($oIE)

0016: 0-6: $iNumFrames = @extended

0017: 0-6: MsgBox(0, "Noo of Frames",$iNumFrames)

0018: 0-0: For $i = 0 to ($iNumFrames - 1)

0019: 0-0: $oFrame = _IEFrameGetCollection ($oIE, $i)

0021: 0-6: MsgBox(0, "Frame Info", _IEPropertyGet ($oFrame, "locationurl"))

C:\Program Files\AutoIt3\Include\IE.au3 (3042) : ==> The requested action with this object has failed.:

----------------------------------------------

Supose if i supply "src" to _IEPropertyGet ($oFrame,"src")

i'm getting below errors

ine: @error-@extended: Line syntax

0001: 0-0: #AutoIt3Wrapper_UseAnsi=y

0002: 0-0: #AutoIt3Wrapper_run_debug_mode=Y

0003: 0-0: #include <IE.au3>

0005: 0-0: $oIE = _IECreate("http://136.151.39.149:7001/vnmWeb",0,1,1,0)

0006: 0-0: sleep(500)

0007: 0-0: Send("testuser{TAB}")

0008: 0-0: sleep(20)

0009: 0-0: Send("pass{ENTER}")

0011: 0-0: _IELoadWait ($oIE)

0012: 0-0: WinSetState("", "", @SW_MAXIMIZE)

0015: 0-0: $oFrames = _IEFrameGetCollection ($oIE)

0016: 0-6: $iNumFrames = @extended

0017: 0-6: MsgBox(0, "Noo of Frames",$iNumFrames)

0018: 0-0: For $i = 0 to ($iNumFrames - 1)

0019: 0-0: $oFrame = _IEFrameGetCollection ($oIE, $i)

0021: 0-6: MsgBox(0, "Frame Info", _IEPropertyGet ($oFrame, "src"))

--> IE.au3 V2.3-1 Error from function _IEPropertyGet, $_IEStatus_InvalidValue (Invalid Property)

0022: 0-0: Next

0019: 0-0: $oFrame = _IEFrameGetCollection ($oIE, $i)

0021: 0-6: MsgBox(0, "Frame Info", _IEPropertyGet ($oFrame, "src"))

--> IE.au3 V2.3-1 Error from function _IEPropertyGet, $_IEStatus_InvalidValue (Invalid Property)

0022: 0-0: Next

0019: 0-0: $oFrame = _IEFrameGetCollection ($oIE, $i)

0021: 0-6: MsgBox(0, "Frame Info", _IEPropertyGet ($oFrame, "src"))

--> IE.au3 V2.3-1 Error from function _IEPropertyGet, $_IEStatus_InvalidValue (Invalid Property)

0022: 0-0: Next

0019: 0-0: $oFrame = _IEFrameGetCollection ($oIE, $i)

0021: 0-6: MsgBox(0, "Frame Info", _IEPropertyGet ($oFrame, "src"))

--> IE.au3 V2.3-1 Error from function _IEPropertyGet, $_IEStatus_InvalidValue (Invalid Property)

0022: 0-0: Next

0019: 0-0: $oFrame = _IEFrameGetCollection ($oIE, $i)

0021: 0-6: MsgBox(0, "Frame Info", _IEPropertyGet ($oFrame, "src"))

--> IE.au3 V2.3-1 Error from function _IEPropertyGet, $_IEStatus_InvalidValue (Invalid Property)

0022: 0-0: Next

0019: 0-0: $oFrame = _IEFrameGetCollection ($oIE, $i)

0021: 0-6: MsgBox(0, "Frame Info", _IEPropertyGet ($oFrame, "src"))

--> IE.au3 V2.3-1 Error from function _IEPropertyGet, $_IEStatus_InvalidValue (Invalid Property)

0022: 0-0: Next

0024: 0-0: ConsoleWrite(_IEDocReadHTML($oIE) & @CR)

post-32077-1204137354_thumb.jpg

Link to comment
Share on other sites

Dale,

I tried to access the frame using name of that, but i got below errorr..

$oFrame = _IEFrameGetObjByName ($oIE, "helpFrame")

ConsoleWrite(_IEPropertyGet ($oFrame, "locationurl") & @CR)

---------------

SCITE LOG

0012: 0-0: WinSetState("", "", @SW_MAXIMIZE)

0017: 0-0: $oFrame = _IEFrameGetObjByName ($oIE, "hiddenframe")

C:\Program Files\AutoIt3\Include\IE.au3 (674) : ==> The requested action with this object has failed.:

If String($o_object.document.body.tagName) = "FRAMESET" Then

If String($o_object.document^ ERROR

->18:37:01 AutoIT3.exe ended.rc:1

Link to comment
Share on other sites

The screen shot is not enough to see what is behind it all.

Suggest you add _IEErrorHandlerRegister() near the top of your script to see if you are getting and COM errors.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

please refer the scrren shot for error mesage i got when i tracked through

_IEErrorHandlerRegister()

below is the SCITE Console message.

-----------------------------

0054: 1-0: Return

C:\Program Files\AutoIt3\Include\IE.au3 (2499) : ==> Object referenced outside a "With" statement.:

SetExtended($oTemp.GetElementsByTagName ($s_TagName).length)

SetExtended($oTemp.GetElementsByTagName ($s_TagName)^ ERROR

->19:15:07 AutoIT3.exe ended.rc:1

I want to share some intresting things which i observed through this period.

-------------------------------------------------------------------------------------------

i have developed below 2 html pages. i tried access the form in the page .

first i tried to deploy in local tomcat server and worked fine.when i deployed in remote tomcat server, it is not working..

here is code and 2 html files.

----------------------------

#AutoIt3Wrapper_UseAnsi=y

#AutoIt3Wrapper_run_debug_mode=Y

#include <IE.au3>

_IEErrorHandlerRegister ("MyErrFunc")

$oIE = _IECreate("http://localhost:8090/Examp/SCSelection.html",0,1,1,0)

_IELoadWait ($oIE)

WinSetState("", "", @SW_MAXIMIZE)

$TsecConframe = _IEFrameGetObjByName($oIE, "cifa")

sleep(500)

$TsecCon_Form = _IEFormGetObjByName ($TsecConframe, "SecContainerForm")

$oSelect = _IEFormElementGetObjByName($TsecCon_Form, "secContainerName")

_IEFormElementOptionselect ($oSelect, 5, 1, "byIndex")

_IEErrorHandlerDeregister ()

; Do something else

; Register the default IE.au3 COM Error Handler

_IEErrorHandlerRegister ()

SCSelection.html

Link to comment
Share on other sites

Ok, that is what I was expecting. The Access is Denied errors result from the embedded frames pointing to source hosted in a different domain than their parent document. Browser security prevents scripting across such frames.

Your only recourse is to open the individual frames in a new browser window. You can then script that document independently.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Hi Dale,

Finally issue is solved..here main problem is if the deployed in local machine it is workning fine.if it is delpoyed in remote we are getting access denied errors.

and in the SCITE console getting below error.

-------------------------------------------------------

IE.au3 V2.3-1 Warning from function _IELoadWait, $_IEStatus_AccessIsDenied (Cannot verify readyState. Likely casue: cross-site scripting security restriction.)

any idea how to make this work ,even when it is deployed in remote machine also...?

Your help is greatly appreciated on this..you are great.. thank you so much....

Link to comment
Share on other sites

Did you call _IELoadWait directly or was it called by another function?

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...