单击 puppeteer 中的元素后,如何等待网络空闲?
const browser = await puppeteer.launch({headless: false});
await page.goto(url, {waitUntil: 'networkidle'});
await page.click('.to_cart'); //Click on element trigger ajax request
//Now I need wait network idle(Wait for the request complete)
await page.click('.to_cart');
Run Code Online (Sandbox Code Playgroud)
UPD:点击元素后没有导航
我试图将当前用户 ID 传递给 docker-compose.yml
它看起来如何 docker-compose.yml
version: '3.4'
services:
app:
build:
context: ./
target: "php-${APP_ENV}"
user: "${CURRENT_UID}"
Run Code Online (Sandbox Code Playgroud)
而不是CURRENT_UID=$(id -u):$(id -g) docker-compose up -d
我写了makefile
#!/usr/bin/make
SHELL = /bin/sh
up:
export CURRENT_UID=$(id -u):$(id -g)
docker-compose up -d
Run Code Online (Sandbox Code Playgroud)
但是CURRENT_UID
我跑的时候还是空的make up
makefile 中是否有可能的导出 uid?
我正在尝试使用 puppeteer 编写 Jest 测试
describe('Downloads', () => {
it(`should refirect to download page for ios`, async () => {
await page.setUserAgent('exotic');
let response = await page.goto(`http://localhost:8888/downloads`, {waitUntil: "networkidle0"});
let url = page.url();
expect(response.status()).toBe(303);
expect(url).toBe(`http://localhost:8888/downloads/ios`);
});
});
Run Code Online (Sandbox Code Playgroud)
但响应状态是200
因为goto
返回响应http://localhost:8888/downloads/ios
如何获取重定向状态码?
我正在尝试调试CLI脚本,而Xdebug无法连接到PhpStorm。
我Operation now in progress (29).
在Xdebug远程日志中看到错误。
我确定Xdebug配置正确,但是我不知道如何调试PhpStorm。
由https://xdebug.org/wizard.php生成的phpinfo()的摘要
Tailored Installation Instructions
Summary
Xdebug installed: 2.6.1
Server API: Command Line Interface
Windows: no
Zend Server: no
PHP Version: 7.1.24
Zend API nr: 320160303
PHP API nr: 20160303
Debug Build: no
Thread Safe Build: no
OPcache Loaded: no
Configuration File Path: /usr/local/etc/php
Configuration File: /usr/local/etc/php/php.ini
Extensions directory: /usr/local/lib/php/extensions/no-debug-non-zts-20160303
You're already running the latest Xdebug version
Run Code Online (Sandbox Code Playgroud)
Xdebug日志
Log opened at 2019-02-19 11:59:37
I: Connecting to configured address/port: 46.201.50.194:9000.
W: …
Run Code Online (Sandbox Code Playgroud) 如果测试是异步的并且可能抛出错误,如何检查每个元素是否通过测试
const exists = async () => {//can throw an error}
const allExists = [12, 5, 8, 130, 44].every(exists);
Run Code Online (Sandbox Code Playgroud)