小编mat*_*ish的帖子

单击 puppeteer 中的元素后,如何等待网络空闲?

单击 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:点击元素后没有导航

javascript node.js puppeteer

12
推荐指数
1
解决办法
1万
查看次数

在 docker-compose 的 makefile 中导出当前用户 ID

我试图将当前用户 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?

makefile docker docker-compose

10
推荐指数
1
解决办法
4226
查看次数

如何在 puppeteer 中获取重定向状态?

我正在尝试使用 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

如何获取重定向状态码?

jestjs puppeteer

4
推荐指数
1
解决办法
2232
查看次数

轮询成功,但出错:操作正在进行中(29)。当Xdebug尝试从docker容器连接到PhpStorm时

我正在尝试调试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)

xdebug phpstorm docker

3
推荐指数
2
解决办法
3185
查看次数

如何将数组与异步/等待一起使用?

如果测试是异步的并且可能抛出错误,如何检查每个元素是否通过测试

const exists = async () => {//can throw an error}
const allExists = [12, 5, 8, 130, 44].every(exists);
Run Code Online (Sandbox Code Playgroud)

javascript

1
推荐指数
1
解决办法
2722
查看次数