Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/79.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 如何使用Puppeter刮取元素标记的值_Javascript_Html_Jquery_Web Scraping_Puppeteer - Fatal编程技术网

Javascript 如何使用Puppeter刮取元素标记的值

Javascript 如何使用Puppeter刮取元素标记的值,javascript,html,jquery,web-scraping,puppeteer,Javascript,Html,Jquery,Web Scraping,Puppeteer,但是我需要知道如何获取“数据自动化id”的值。看起来您正在尝试捕获数据属性的值。可以通过如下方式引用按钮元素的数据集来执行此操作: let mybutton=document.querySelector('button[class=“button width full button--primary”]); 让autoId=mybutton.dataset.automationId; console.log(autoId) 登录 <button class="butto

但是我需要知道如何获取“数据自动化id”的值。看起来您正在尝试捕获数据属性的值。可以通过如下方式引用按钮元素的
数据集来执行此操作:

let mybutton=document.querySelector('button[class=“button width full button--primary”]);
让autoId=mybutton.dataset.automationId;
console.log(autoId)
登录
    <button class="button width-full button--primary" data-automation-id="signin-submit-btn" data-tl-id="signin-submit-btn" type="submit"><span class="button-wrapper">Sign in</span></button>
document.querySelector('button[class="button width-full button--primary"]').innerText;