在puppeteer中,从表单的选择输入类型中选择选项的最佳方式是什么? 我听说puppeteer中有一个bug,.type()方法不是理想的处理方式。表单中的select输入类型具有按数字顺序设置的选项值。我能简单地使用这个代码来设置值吗? page.$x('/html/body/div[1]/form/div[2]/div/div[10]/select').then( (el) => {
el.type('1'); // 1 is the first <option value="1">foo</
我正在尝试使用Puppeteer在网页上填写表单,但是有一些输入字段只接受数字输入,例如:
<input type="text" inputmode="numeric">
但是,我不能像普通输入字段那样用page.type写入这些输入字段。当我尝试时,我会得到错误消息:
TypeError: text is not iterable
在所有其他输入上,page.type工作得非常好。
我有以下jQuery函数:
提交表格
$(“.content”).delegate(‘..entryButton’,'click',函数(){ var form = $(this).closest("form");var id = form.attr('id');var text = form.find("textarea").val();Sijax.request('add_entry',id,text);
//防止表单被提交(默认HTML)返回false;};
放大表单并显示输入按钮。
$(
我可以使用puppeteer导航到页面,但之后page.evaluate不会返回任何响应。此外,我也无法在page.evaluate内部进行调试。我在调试模式(node debug filename.js)中运行脚本,使用sb(15)设置第15行的断点,按c继续,等待页面加载,然后输入'repl‘。现在,当我尝试调试时,它说是document is not defined。我如何解决这两个问题?
const puppeteer = require('puppeteer');
(async function scrape() {
const browser = aw
<form name="v" ng-submit="submit()" ng-controller="ExampleController">
Enter text and hit enter OUTER FORM:
<input type="text" ng-model="text" name="texta" />
<input type="submit" id="submit" value="Submit"
我使用以下代码提交了一个表单,并希望Puppeteer在表单提交后等待页面加载。
await page.click("button[type=submit]");
//how to wait until the new page loads before taking screenshot?
// i don't want this:
// await page.waitFor(1*1000); //← unwanted workaround
await page.screenshot({path: 'example.png'});
如何使用傀儡等待