Jump to content

Get a document reference


Recommended Posts

Hi i am new to this.We have software for automation right now with the script i able to login into home page of it now i have to click a image of the page so i am not able to get the reference of the page please help me. i have used IE management for the scripting.Below is the script:

#include <IE.au3>

$oIE = _IECreate ("url")

$o_form = _IEFormGetObjByName ($oIE, "name")

$o_Username = _IEFormElementGetObjByName ($o_form, "TextBox1")

$o_password = _IEFormElementGetObjByName ($o_form, "TextBox2")

$o_Login = _IEFormElementGetObjByName ($o_form, "Button1")

$username = "Username"

$password = "passwd"

_IEFormElementSetValue ($o_Username, $username)

_IEFormElementSetValue ($o_password, $password)

_IEAction ($o_Login, "click")

$oDoc = _IEDocGetObj (objref) here is the problem

_IEFormImageClick($oDoc, "mage path")

Link to comment
Share on other sites

Could you be more specific? If you want to click on an image use the "_IEImgClick()" function, the reference of the page is already available in your "$oIE" variable

Thanks for ur reply. $oIE is reference for login page now i am in home page and i want a ref for that.In the code i have already used the ref $oIE variable.I will tell an example just to understand with the use of script i have logined into yahoomail now i want clik inbox so how to get the script to click inbox.

Link to comment
Share on other sites

Ok, "$oIE" doesnt references the login page, it references the IE Object so after you clicked the image use a "_IELoadWait($oIE)" and you will be able to manipulate the home page

_IEFormImageClick ($oIE, "Image path", "src")

_IELoadWait($oIE)

as of u above is the script but not working.

Link to comment
Share on other sites

i am able to login but not able to click on image.I will tell u so that u can catch my problem for example i logged into yahoomail now i have to click on a add image, so how to do the script for to click on the image.

Link to comment
Share on other sites

#include <IE.au3>

$oIE = _IECreate ("www.Yahoomail.com")

$o_form = _IEFormGetObjByName ($oIE, "login_form")

$o_Username = _IEFormElementGetObjByName ($o_form, "login")

$o_password = _IEFormElementGetObjByName ($o_form, "passwd")

$o_Login = _IEFormElementGetObjByName ($o_form, ".save")

$username = "type username"

$password = "passwd"

_IEFormElementSetValue ($o_Username, $username)

_IEFormElementSetValue ($o_password, $password)

_IEAction ($o_Login, "click")

_IEImgClick ($oLi, "http://us.i1.yimg.com/us.yimg.com/i/nt/ic/ut/bsc/nwmail16_1.gif", "src")(here is the problem)

_IELoadWait($oIE)

If u dont mind try this and get me a script for clicking my inbox.

Link to comment
Share on other sites

As JavaCupiX pointed out, $oIE is a reference to the Internet Explorer Automation object, not to the specific embedded document object. Most of the _IE functions start with this automation object and then automatically reference the _current_ document object contained within. This way you can get the $oIE object reference once and not have to worry about refreshing it each time the document changes or reloads as you would it you were coding this yourself.

So, put $oIE where you have $oLi and you should be set.

Also, please insure you run your code from inside SciTe (use Tools -> Go) as IE.au3 writes many helpful diagnostic messages to the console.

Dale

Edit: typo

Edited by DaleHohm

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...