Sign in to follow this  
Followers 0
mirrorball

Is the current url a variable?

3 posts in this topic

Hi there,

This is my first post and I'm a little nervous about posting ... hopefully, I can provide enough information to make my question worthwhile.

I'm trying to write a script that launches a web-site and clicks on a link and then completes a form on the new website and submits it.

I've read through a lot of examples and it all seems very do-able but I have one bit I'm stuck on ...

Launching the first web-site is fine ... and finding the link to click is fine (the image to click on is always called submit.gif so I have used _IEImgClick). I thought the completion on the form would be easy as well but it seems that to use functions like _IEFormGetObjByName I need to set $oIE to the url I am currently working with.

This is where my problem arises ... I don't know the url I am currently working with ... the link that I've clicked on is slightly different each time I visit the site as is the landing page and the title of the landing page however the content of the landing page contains many of the same elements (including the form that I want to submit)

Below is the kind of code I am writing ...

CODE
$oIE = _IECreate ("http://www.website.co.uk", 1)

_IEImgClick ($oIE, "submit.gif", "src")

Sleep(5000) ;five seconds

$oForm = _IEFormGetObjByName ($oIE, "search")

$oQuery = _IEFormElementGetObjByName ($oForm, "s")

_IEFormElementSetValue ($oQuery, "Christmas")

_IEFormSubmit ($oForm)

As I see it there are two ways I can achieve what I want to:

1) I can get the url of the newly opened IE window and use that in my _IEFormGetObjByName command

2) I can find out the url of the link, set $oIE to that and launch that URL using _IECreate rather than simulating the mouse click from the _IEImgClick command

Unfortunately, I don't know how to do either so I'm hoping that someone on this forum can point me in the right direction.

Like I say, I'm a bit nervous but I hope I have explained what my problem is ...

Share this post


Link to post
Share on other sites



I could not find an image (using FF or IE) in the entire source named submit.gif, I was going to look for a workaround, since I cannot answer your exact question, sorry I couldn't help.

Share this post


Link to post
Share on other sites

I don't see a submit.gif either... perhaps you can explain in more detail what you see and what you are trying to do.

Please be certain to run your script from the AutoIt SciTe editor and watch the console for helpful messages. Also consider installing DebugBar (see my sig) for some help seeing the objects on the page.

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

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