PDA

View Full Version : Internet Explorer Automation Wait for HTML Tag to appear



j.smith1981
09-16-2009, 05:53 AM
I have a big problem here.

I am trying desperately to search google for a precise example but there's a severe lack of anything thats relevant to what I want my macro to do.

All I want basically its quite simple actually.

Open an IE browser window (done that).

Navigate to a page (again done that)

Login (done that)

Navigate to a page to start off this process (done that).

Enter the details for the products processing php script (works up to this point).

What I want it to do ultimately, is when the process of the upload of products is progressing, is to somehow loop, until a tag exists on the page shown <div id="status_message"></div> exists then compare it to a value.

The value being <div id="status_message">Successs</div>.

Else
'put in what you want, will replace this with an email function to send myself an email should it fail

Then click a button in the web page (to logout) and then exit internet explorer.

Can someone help me with this?

I have been through about 2,000 websites now trying to find something to get this macro working but nothings working the way I want it to.

Can someone here help?

Thanks,
Jeremy.:banghead:

rbrhodes
09-16-2009, 11:19 PM
Hi Jeremy,

Seems this is probably related to:

http://www.vbaexpress.com/forum/showthread.php?p=194685#post194685

I've recently built a series of subs (a program in progress really) to update a downloaded site CSV with CSV data from suppliers. One of the steps I was looking at was how to download ( my subs do the update) and then upload the file.

So I looked at your solution. Seems to me rather than an ftp batch file etc just save the file to the FTP location! Then prcess it there.

Here's hoping you're doing the suppliers updates manually - I'll sell you my program!

j.smith1981
09-17-2009, 02:18 AM
I have it working sort of.

I have left more than enough time for now just going to have to keep an eye on it for a bit to make sure it runs.

But when its importing into X Cart, the system we are automatically updating each hour.

If I get it to wait until say 20 or so minutes to wait for it to process the CSV, this will work, then detect a div id value (innerHTML possibly).

The problem I am facing is I have a <div id="status_message">File Imported Successfully</div> or if its failed a value between the div tags "failed"

How to I retrieve these values in a msgbox for testing purposes?

Thanks ever so much for your help, but I think this is probably the best way for now until I come up with maybe a better solution, just means id have to wait 20 minutes to get feedback but can blame that on the system haha.

Thanks ever so much,
Jeremy.

Does someone know how to get the value of that div id back in a msgbox? I know for a fact its possible but just cant remember for the life of me how to get it coming back, just its complaining about it needing an object or something but not quite sure how to go about doing this, then I can say if it comes back with anything else than (<>) the success message, email me and then close Internet explorer.

j.smith1981
09-18-2009, 01:28 AM
Hi Jeremy,

Seems this is probably related to:

http://www.vbaexpress.com/forum/showthread.php?p=194685#post194685

I've recently built a series of subs (a program in progress really) to update a downloaded site CSV with CSV data from suppliers. One of the steps I was looking at was how to download ( my subs do the update) and then upload the file.

So I looked at your solution. Seems to me rather than an ftp batch file etc just save the file to the FTP location! Then prcess it there.

Here's hoping you're doing the suppliers updates manually - I'll sell you my program!

Ah cool, I mean I have it working sort of to a time delay.

By where because X Cart goes through several processes, it cant import the whole CSV at once, like it goes through a series of steps, dont have a clue why the X Cart developers do this because its very annoying why I am stuck with this bug really.

But what I have decided with the network technician here, is to allow it to process for a set period of time, say 30minutes or something, giving it more than enough time to process.

Its probably about 1.5 minutes or something it takes at present for it to process, set at 2, but when we get the bigger file, complete set of products and the macro is on a server, I will set that to 30, it then emails me if there's a tag that exists at the end saying error or success and actually emails me that response, albeit 30minutes later in effect when its either done or completed, due to wanting to keep an eye on it.