关闭弹窗代码java,VBA关闭Java提醒弹出窗口,名称为“来自网页的消息”

Im having a problem dealing with the java scripts alerts..

I am able to navigate and enter data in the webpage but when selecting different item to update a modal alerts displayed..

How can I click the OK button tru VBA?

Any help please...

Here is the code in the webpage i think firing when i select an item triggering the alert..

This is what i see in the HTML scripts:

function onUpdatedShowAlertTS(varControl) {

if (varControl == "ddlProjectStatus") {

var varconfirm = document.getElementById('ctl00_Tabs_pnlCaptureTSMetrics_CaptureTSMetrics_hdnReleaseStatusConfirmation');

if (varconfirm.value == "true") {

var varControlId = document.getElementById('ctl00_Tabs_pnlCaptureTSMetrics_CaptureTSMetrics_ddlProjectStatus');

var value = varControlId.options[varControlId.selectedIndex].innerText;

alert('Release status is reset to ' + value + ' successfully and validation status is Pending.');

document.getElementById('ctl00_Tabs_pnlCaptureTSMetrics_CaptureTSMetrics_hdnReleaseStatusConfirmation').value = "false";

}

}

if (varControl == "ddlReleaseName") {

var varconfirm = document.getElementById('ctl00_Tabs_pnlCaptureTSMetrics_CaptureTSMetrics_hdnReleaseNameConfirmation');

if (varconfirm.value == "true") {

alert('Release status and and validation status is reset successfully.');

var isReadOnlyStatus = '0'

if (!(isReadOnlyStatus == 1)) {

document.getElementById('ctl00_Tabs_pnlCaptureTSMetrics_CaptureTSMetrics_hdnReleaseNameConfirmation').value = "false";

document.getElementById('ctl00_Tabs_pnlCaptureTSMetrics_CaptureTSMetrics_btnSaveValidate').disabled = false;

}

}

}

This is my code:

ieDoc.getElementById("ctl00_Tabs_pnlCaptureTSMetrics_CaptureTSMetrics_hdnConfirmationforReleaseChange").Click

ieDoc.getElementById("ctl00_Tabs_pnlCaptureTSMetrics_CaptureTSMetrics_hdnConfirmationforReleaseChange").setAttribute "value", "true"

ieDoc.getElementById("ctl00_Tabs_pnlCaptureTSMetrics_CaptureTSMetrics_hdnConfirmationforReleaseChange").setAttribute "type", "hidden"

解决方案

One immediate solution would be to use the SendKeys function.

Application.SendKeys "n" ' Send the latter "n" to the dialog

Application.SendKeys "{ENTER}" ' Send ENTER to the dialog

You can find more information on SendKeys here.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值