PDA

View Full Version : HTML click not consistently working



bho
12-19-2016, 07:06 PM
I have a VBA script that loops through stocks, and goes to a website to get a custom chart for each. Once the chart comes up, it saves the chart, and gets the URL for it.

The script works great, but unfortunately, the most important event in the script is the Save Chart. It is part of a table, but acts like a button. On the first stock, the command to click works great, but then, each subsequent stock runs the event (to click), but then does not open the next window as it is supposed to.

Here is the VBA...


Set IEDoc = IE.Document.querySelector("td[title='Save Chart']")
IEDoc.Click

And here is the HTML...


<tr data-menuitem="save" style=border: 1px solid rgb(174, 185, 197); height: 32px; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: noraml; font-size: 11px; line-height: normal; font-family: Arial; background-color: transparent;">
<td valign="middle" align=center" title="Save Chart">...</td>
</tr>

Again... the first loop works great, and then the 2nd and subsequent loops pass right by the IEDoc.Click (I know from stepping through code), but then nothing happens.

Thoughts?