Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/430.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 在e2e按钮上执行单击功能_Javascript_Cefsharp_Chromium Embedded_E2e - Fatal编程技术网

Javascript 在e2e按钮上执行单击功能

Javascript 在e2e按钮上执行单击功能,javascript,cefsharp,chromium-embedded,e2e,Javascript,Cefsharp,Chromium Embedded,E2e,首先,我要说的是,我从来没有使用过有棱角的和半新的javascript。我正在一个项目中使用CEFSharp。我使用的大多数代码都基于document.getElementsByClassName和document.getElementById。我可以让我的程序毫无问题地执行单击元素 然而,这是我第一次在按钮上碰到e2e数据。直到现在我才听说e2e <button data-e2e="creative.response" data-e2e-variant="n

首先,我要说的是,我从来没有使用过有棱角的和半新的javascript。我正在一个项目中使用CEFSharp。我使用的大多数代码都基于document.getElementsByClassName和document.getElementById。我可以让我的程序毫无问题地执行单击元素

然而,这是我第一次在按钮上碰到e2e数据。直到现在我才听说e2e

<button data-e2e="creative.response" data-e2e-variant="negative" width="100%,100%,auto" class="sc-lmoMRL sc-iIEYCM fsMcEt jtcAQi">No thanks</button>
不用了,谢谢
解决这个问题的最好办法是什么

            var word = 'No thanks', queue = [document.body], curr;
            while (curr = queue.pop()) {
                if (!curr.textContent.match(word)) continue;
                for (var i = 0; i < curr.childNodes.length; ++i) {
                    switch (curr.childNodes[i].nodeType) {
                        case Node.TEXT_NODE: // 3
                            if (curr.childNodes[i].textContent.match(word)) {
                                curr.click();
                            }
                            break;
                        case Node.ELEMENT_NODE: // 1
                            queue.push(curr.childNodes[i]);
                            break;
                    }
                }
            }
var-word='No-thank',queue=[document.body],curr;
while(curr=queue.pop()){
如果(!curr.textContent.match(word))继续;
对于(变量i=0;i
我已经试过上面的方法,但它在按按钮时有斑点


至少为我指出我需要学习的正确方向,以便更好地理解如何识别并单击这些e2e元素

您可以根据其数据属性选择元素,请参见“完美”。这很有效。非常感谢。