Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/468.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 木偶演员-具有多个选择器的选择元素_Javascript_Jquery_Html_Selector_Puppeteer - Fatal编程技术网

Javascript 木偶演员-具有多个选择器的选择元素

Javascript 木偶演员-具有多个选择器的选择元素,javascript,jquery,html,selector,puppeteer,Javascript,Jquery,Html,Selector,Puppeteer,我有以下html: <html> <body> <div title="test" class="test">hello</div> <input onclick="" type="confusepuppet" value="google" class="button"> <form action="http://yahoo.com"> <input onclick="" ty

我有以下html:

<html>

<body>
    <div title="test" class="test">hello</div>
    <input onclick="" type="confusepuppet" value="google" class="button">
    <form action="http://yahoo.com">
        <input onclick="" type="submit" value="yahoo" class="button">
    </form>
    <form action="http://google.com">
        <input onclick="" type="submit" value="google" class="button">
    </form>


</body>

</html>

你好
假设我想点击按钮重定向到google.com,我不能使用value=“google”或type=“submit”,我必须同时使用value=“google”和type=“submit”来避免点击错误的按钮

我如何在木偶戏中做到这一点

这不起作用:


等待页面。单击('input[value=“google”,type=“submit”]”)

多值选择器:

等待页面。单击('input[value=“google”][type=“submit”]”);

多值选择器:

等待页面。单击('input[value=“google”][type=“submit”]”);
您可以使用

你可以用

const element = await page.$('[value="google"]');
await element.click();