无法单击确定弹出按钮javascript

时间:2017-05-03 03:09:57

标签: javascript html firefox button selenium-ide

我有一个关于弹出按钮javascript的案例,很难点击" OK"按钮。通常我使用"断言确认"命令,但"断言确认"不行。我使用chooseOkOnNextConfirmation这是硒中的绿灯,但没有点击按钮"确定"。并点击" css = button"在硒中出现红光"未找到元素"。

如果使用记录,则不显示命令。代码的确认按钮是第1行

我的工具是:selenium IDE 2.9.1和firefox:47.0.2 [picture Popup] [picture selenium command] 2



<input type="button" style="clsButton" onclick="onContinue(this.form);" value="Confirm" name="continueButton">
&#13;
&#13;
&#13;

&#13;
&#13;
function checkLoad() {
    if (window.menubar.visible == true && window.toolbar.visible == true) {
        window.location=checkLoad1;
    }
}

var message="";

function clickNS(e) {
    if (document.layers||(document.getElementById&&!document.all)) {
        if (e.which==2||e.which==3 | e.which == 5 || e.which == 10 ||
            e.which == 11 || e.which == 12 || e.which == 20 ||  e.which == 25 || e.ctrlk) {
            (message);return false;
        }
    } else {
        if (event.keyCode==0 || event.keyCode==2||event.keyCode==3 | event.keyCode == 5 || event.keyCode == 10 ||
            event.keyCode == 11 || event.keyCode == 12 || event.keyCode == 20 ||  event.keyCode == 25) {
            (message);return false;
        }
    }
}

function disableCtrlKeyCombination(e) {
    //list all CTRL + key combinations you want to disable
    var forbiddenKeys = new Array('n', 'j');
    var key;
    var isCtrl;

    if(window.event)
    {
            key = window.event.keyCode;     //IE
            if(window.event.ctrlKey)
                    isCtrl = true;
            else
                    isCtrl = false;
    }
    else
    {
            key = e.which;     //firefox
            if(e.ctrlKey)
                    isCtrl = true;
            else
                    isCtrl = false;
    }

    //if ctrl is pressed check if other key is in forbidenKeys array
    if(isCtrl)
    {
            for(i=0; i<forbiddenKeys.length; i++)
            {
                    //case-insensitive comparation
                    if(forbiddenKeys[i].toLowerCase() == String.fromCharCode(key).toLowerCase())
                    {
                            alert("Key combination CTRL + "
                                    +String.fromCharCode(key)
                                    +" has been disabled.");
                            return false;
                    }
            }
    }
    return true;
}

if (document.layers) {
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown=clickNS;
}
else{
    document.onmouseup=clickNS;
}

document.oncontextmenu=clickNS

document.onkeypress=disableCtrlKeyCombination
document.onkeydown=disableCtrlKeyCombination

function mouseDown(e) {
    var shiftPressed=0;

    if (parseInt(navigator.appVersion)>3) {
        if (navigator.appName=="Netscape") {
            shiftPressed=(e.shiftKey || e.ctrlKey);
        } else shiftPressed=event.shiftKey;

        if (shiftPressed) {
            alert ('Shift-click is disabled.')
            return false;
        }
    }

    return true;
}

if (parseInt(navigator.appVersion)>3) {
    document.onmousedown = mouseDown;

    if (navigator.appName=="Netscape")
        document.captureEvents(Event.MOUSEDOWN);
}
&#13;
<html>
<head>
<frameset framespacing="0" border="0" frameborder="NO" cols="*" rows="130,*">
<frame id="topFrame" noresize="noresize" scrolling="NO" name="topFrame" src="/corp/common2/login.do?action=topRequest">
<frameset framespacing="0" border="0" frameborder="NO" cols="213,*" rows="*">
<frame id="menuFrame" scrolling="YES" name="menuFrame" src="/corp/common2/login.do?action=menuRequest">
<frame id="mainFrame" name="mainFrame" src="/corp/common2/login.do?action=mainRequestLoad">
<html>
<head>
<body>
<form onsubmit="return false;" enctype="multipart/form-data" action="/corp/front/uploadinvoicesupplychaincustom.do" method="post" name="UploadInvoiceSupplyChainCustomActionForm">
<table id="Upload Invoice" class="tab-group" width="100%" cellspacing="0" cellpadding="0" height="20">
<table width="100%" cellspacing="0" border="0" height="20">
<table class="clsForm" width="100%" cellpadding="1" border="0">
<table width="100%">
<tbody>
<tr class="clsButton">
<td colspan="2">
<input type="button" style="clsButton" onclick="onContinue(this.form);" value="Confirm" name="continueButton">
</td>
</tr>
</tbody>
</table>
</form>
<script charset="utf-8" src="/corp/combined.js.h-778744318.pack" type="text/javascript">
<script src="/common/js/disable.js" type="text/javascript">
<script>
<script type="text/javascript">
</body>
</html>
</frame>
</frameset>
</frameset>
</html>
&#13;
&#13;
&#13;

请帮助我并感谢解决方案

0 个答案:

没有答案