I am stumped. I have vba code that fills a website form fields and, for years, has successfully clicked a continue button at the bottom of the page. Recently, the website made changes that have derailed that last step - clicking the continue button.
The HTML code for the button now reads as:
<input type="submit" name="PaymentProcessor$ButtonContinue" value="Confirm" onclick="javascript:PaymentProcessor_ButtonContinue.disabled=true;__doPostBack('PaymentProcessor$ButtonContinue','');WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("PaymentProcessor$ButtonContinue", "", true, "", "", false, false))" id="PaymentProcessor_ButtonContinue" class="btn btn-default" style="font-weight:normal;font-style:normal;text-decoration:none;" />
In the past, I have defined ieObj As HTMLInputElement and clicked the button like this:
Set ieObj = iePage.getElementById("PaymentProcessor_ButtonContinue")
ieObj.Click
Now, that no longer works. I don't get an error, nothing happens. I can see the ieobj get populated in the locals window, so I think I have the correct handle, I just can't manipulate the object.
I have also tried the following:
ieObj.FireEvent ("onkeypress")
''no error, no effect
ieObj.FireEvent ("doPostBack")
''error
ieObj.submit
''error- does not support method
ieObj.Value = "continue"
''no error, no effect
ieObj.Value = "confirm"
''no error, no effect
I also tried invoking the javascript portion of that html directly, but I am probably doing it wrong:
iePage.parentWindow.execScript "document.getElementById('PaymentProcessor_ButtonContinue').submit();", "javascript"
''gives automation error
iePage.parentWindow.execScript "__doPostBack('PaymentProcessor$ButtonContinue','');WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("PaymentProcessor$ButtonContinue", "", true, "", "", false, false));", "javascript"
''gives automation error
I made an effort to utilize queryselector and queryselectorall, but both methods made Access crash.
Elsewhere on the page, the below javascript functions are defined. I don't know if is important, but it is below:
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['Form1'];
if (!theForm) {
theForm = document.Form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
</script>
Any Ideas I should try?