1

我在处理 java 脚本警报时遇到问题..

我可以在网页中导航并输入数据,但是选择不同的项目以更新显示的模式警报。

如何单击确定按钮 tru VBA?

任何帮助请...

这是网页中的代码,我认为当我选择触发警报的项目时会触发..

这是我在 HTML 脚本中看到的:

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;
}
}
}

这是我的代码:

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"
4

1 回答 1

1

一种直接的解决方案是使用该SendKeys功能。

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

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

您可以在此处找到有关SendKeys 的更多信息。

于 2013-08-07T22:18:41.197 回答