Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 捕获使用Selenium单击按钮时打开和关闭的div_Javascript_Html_Jquery - Fatal编程技术网

Javascript 捕获使用Selenium单击按钮时打开和关闭的div

Javascript 捕获使用Selenium单击按钮时打开和关闭的div,javascript,html,jquery,Javascript,Html,Jquery,当点击按钮时,页面被刷新,框架及其div在后面添加了一个运行的js代码。我正在尝试使用selenium访问iframe中的表单元素,但由于上述事件,我无法访问。我在等待你的建议。当我点击按钮时,框架打开,当我关闭框架时,div和框架元素从页面中消失 z=web.find_elements_by_tag_name("iframe") k=web.find_elements_by_name("iframe") p=z[0]

当点击按钮时,页面被刷新,框架及其div在后面添加了一个运行的js代码。我正在尝试使用selenium访问iframe中的表单元素,但由于上述事件,我无法访问。我在等待你的建议。当我点击按钮时,框架打开,当我关闭框架时,div和框架元素从页面中消失

     z=web.find_elements_by_tag_name("iframe")


     k=web.find_elements_by_name("iframe")


     p=z[0].get_attribute("name")


     web.implicitly_wait(10)
     web.switch_to.frame(p)
     web.implicitly_wait(10)
     o=web.find_element_by_xpath("//*[@id='passwordfield']")
     o.send_keys("1234")
buton html:

<input id="paymentForm:buyDirect3DButton" type="submit" name="paymentForm:buyDirect3DButton" value="Satın Al" class="btn">

单击打开的主div:

 <div class="fancybox-overlay fancybox-overlay-fixed" style="width: auto; height: auto; display: block;"><div class="fancybox-wrap fancybox-desktop fancybox-type-iframe threedpop fancybox-opened" tabindex="-1" style="width: 775px; height: auto; position: absolute; top: 20px; left: 61px; opacity: 1; overflow: visible;"><div class="fancybox-skin" style="padding: 0px; width: auto; height: auto;"><div class="fancybox-outer"><div class="fancybox-inner" style="overflow: auto; width: 767px; height: 565px;"><iframe id="fancybox-frame1619619417753" name="fancybox-frame1619619417753" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="" scrolling="auto" src="threeDRedirect.btx?cns=0PJ19"></iframe></div></div><a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a></div></div></div>



<div class="fancybox-inner" style="overflow: auto; width: 767px; height: 565px;"> 
            <iframe id="fancybox-frame1619619417753" name="fancybox-frame1619619417753" 
          class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitallowfullscreen="" 
        mozallowfullscreen="" allowfullscreen="" scrolling="auto" src="threeDRedirect.btx?cns=0PJ19"> 
       </iframe></div>

我想要达到的要素是:

 <input 3dsinput="password" type="text" class="f-input oninput="maxLengthCheck(this)"onkeypress="return isNumeric(event)" name="password" id="passwordfield"maxlength="8" min="0" max="99999999" inputmode="numeric" pattern="[0-9]*" autocomplete="off">

                                    //<![CDATA[
                                                function showThreeDPop(){
                                                    jQuery.fancybox({
                                                        'wrapCSS'           : 'threedpop',
                                                        'width'             : 750,
                                                        'height'            : 600,
                                                        'type'              : 'iframe',
                                                        'href'              : "threeDRedirect.btx?cns=0PJ19",
                                                        'titleShow'         : false,
                                                        'transitionIn'      : 'fade',
                                                        'transitionOut'     : 'fade',
                                                        'autoScale'         : false,
                                                        'autoDimensions'    : false,
                                                        'centerOnScroll'    : false,
                                                        'overlayShow'       : true ,    
                                                        'overlayOpacity'    :'0.3',     
                                                        'overlayColor'      :'#232839', 
                                                        'padding'           : '0',
                                                        'hideOnOverlayClick': false,
                                                        'hideOnContentClick': false,
                                                        'opacity'           : false,
                                                        'enableEscapeButton': false,
                                                        'afterClose'            : function(){processResult();}
                                                    }); 
                                                }
                            
                                                var popStatus = "false";
                                                
                                                jQuery(document).ready(function(){

                                                    if(popStatus == true || popStatus == "true"){
                                                        
                                                        showThreeDPop();
                                                        var cc_mno=jQuery( "#paymentForm\\:creditCardNo\\:creditCardNoField" ).val();
                                                         if ( cc_mno &&cc_mno.length > 0 && cc_mno.charAt( 0 ) == '5' ) {
                                                                jQuery('#audio')[0].play();
                                                                console.log("mastercard sound3d");
                                                         }
                                                    }
                                                });
                                                    
                                                function processResult(){

                                                jQuery(".processResultLink").trigger('click');
                                                }
                                                  //]]>