In controlling a website, and attempting to delete all of the selected items in a table, I get a Javascript pop-up which asks me if I really want to delete all of them (OK or Cancel). When this pops up, my vba code stops, and will not do anything else, until a human clicks the button.
Here is the HTML, Javascript, and my VBA...
HTML
Expand|Select|Wrap|Line Numbers
- <p>Delete: <input type="button" name="button_Delete" value="Delete" onclick="doDelete('c');"> <span class="note">Deletes all selected charts.</span></p>
- <p>Move to: <select id="select_Lists" name="select_Lists">
- <option value="trash" selected>-> Trash <-</option>
- <option value="245">000-000 AEH</option>
Expand|Select|Wrap|Line Numbers
- <a href="javascript:doDeleteList('169', 'C');">Delete List</a> |
Expand|Select|Wrap|Line Numbers
- Dim ieDelete As HTMLInputButtonElement
- Set ieDelete = IE.Document.getElementsByName("button_Delete")(0)
- Sleep (500)
- ieDelete.removeAttribute ("onClick")
- Sleep (500)
- ieDelete.setAttribute "onClick", "return true;"
- Sleep (500)
- ieDelete.Click
I have even tried printing the onClick values in the immediate window before and after setting it, but it continues to come up...
Expand|Select|Wrap|Line Numbers
- function onclick(event)
- {
- doDelete('c');
- }
While I think this sounds like a pretty good approach, I am open to anything. Thanks for looking.