Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/428.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中为使用Browser.execute的方法使用参数_Javascript - Fatal编程技术网

在JavaScript中为使用Browser.execute的方法使用参数

在JavaScript中为使用Browser.execute的方法使用参数,javascript,Javascript,这段代码有效。我想参数化传递给el.innText的值 selectTemplateCheckBox(){ const checkbox=this.templateCheckBox; const temp=模板名; browser.execute((选择器)=>{ selector.find(el=>el.innerText===“AG-1743RAJ”).previousElementSibling.querySelector('input')。单击(); },复选框); } 如何参数化传递

这段代码有效。我想参数化传递给
el.innText
的值

selectTemplateCheckBox(){
const checkbox=this.templateCheckBox;
const temp=模板名;
browser.execute((选择器)=>{
selector.find(el=>el.innerText===“AG-1743RAJ”).previousElementSibling.querySelector('input')。单击();
},复选框);
}
如何参数化传递AG1743RAJ的任何值的方法

selectTemplateCheckBox(值){
const checkbox=this.templateCheckBox;
const temp=模板名;
browser.execute((选择器)=>{
selector.find(el=>el.innerText==value).previousElementSibling.querySelector('input')。单击();
},复选框);
}
这起作用了

selectTemplateCheckBox(templateName) {
        const checkbox = this.templateCheckBox;
        const temp = templateName; 
        browser.execute((selector, temp) => {
            selector.find(el => el.innerText === `${temp}`).previousElementSibling.querySelector('input').click();
        }, checkbox, temp);  
    }
这起作用了

selectTemplateCheckBox(templateName) {
        const checkbox = this.templateCheckBox;
        const temp = templateName; 
        browser.execute((selector, temp) => {
            selector.find(el => el.innerText === `${temp}`).previousElementSibling.querySelector('input').click();
        }, checkbox, temp);  
    }