Puppeteer

if URL contains function in puppeteer

≯℡__Kan透↙ 提交于 2020-08-09 07:02:30
问题 So I am trying to have my code do something if the URL contains this: https://kith.com/throttle/queue? After the '?' there can be anything, so I only want it to identify 'https://kith.com/throttle/queue?' I am using puppeteer and want it to work like this: If the URL contains 'https://kith.com/throttle/queue?' then wait until it passes the queue (page.waitForNavigation({ waitUntil: 'networkidle2' }) would work for waiting until it's through the queue Else (If the URL doesn't contain that): do

如何重构一个过万Star开源项目—BetterScroll

拈花ヽ惹草 提交于 2020-08-09 01:49:06
过去的 v1 时代 距离 BetterScroll v1 版本发布,至今已经 3 年多,由于它在移动端良好的滚动体验与性能以及多种滚动场景的支持,深受社区的青睐。用户也可以基于 BetterScroll 抽象出各种复杂的业务滚动组件,期间依托于 BetterScroll,我们还开源了基于 Vue2.0 的移动端组件库 cube-ui 。 目前 BetterScroll 的 star 数已经超过 1.1 万,GitHub 有大约 3.2 万仓库使用了它。 滴滴 内部的业务,比如 国内司乘两端 、 国外司乘两端 等核心业务都大量使用 BetterScroll,它经受住了各种业务场景的考验。 随着大量的业务场景使用以及社区的反馈与建议,v1 版本也暴露了一些问题,主要分为如下四个方面: 包体积大,无法按需引用 扩展困难,增强功能易侵入核心逻辑 测试匮乏,稳定性保证差 文档不够友好,社区答疑成本高 v2 将至 先来看下最终的整体 BetterScroll v2 版本的架构图: 从整体架构图可以看出,目前整体 BetterScroll v2 版本除了实现核心滚动外,还额外提供很多插件: picker 高仿 iOS 原生 Picker 组件 mouse-wheel 兼容 PC 鼠标滚轮场景 observe-dom 自动探测 scroll 区域 DOM 改变,并且调用 refresh 方法

Puppeteer - Click div not working

元气小坏坏 提交于 2020-08-08 06:57:06
问题 I'm able to login, but i need to click on a div that has no id and i cant figure out how to do it This is html element. Onclick event (devtool properties) is on the div that has the route (class route-redirect-box) How can i click this link to go to "listachamados" page? Page html: <div class="menu-lateral-contraido-sub-container" title="Lista de Chamados" draggable="true" style="opacity: 1;"> <div to="/main/listachamado/" class="route-redirect-box"><div class="menu-lateral-item-contraido

Pyppeteer: Browser closed unexpectedly in AWS Lambda

岁酱吖の 提交于 2020-08-05 16:47:00
问题 I'm running into this error in AWS Lambda. It appears that the devtools websocket is not up. Not sure how to fix it. Any ideas? Thanks for your time. Exception originated from get_ws_endpoint() due to websocket response timeout https://github.com/pyppeteer/pyppeteer/blob/ad3a0a7da221a04425cbf0cc92e50e93883b077b/pyppeteer/launcher.py#L225 Lambda code: import os import json import asyncio import logging import boto3 import pyppeteer from pyppeteer import launch logger = logging.getLogger()

Pyppeteer: Browser closed unexpectedly in AWS Lambda

本秂侑毒 提交于 2020-08-05 16:42:27
问题 I'm running into this error in AWS Lambda. It appears that the devtools websocket is not up. Not sure how to fix it. Any ideas? Thanks for your time. Exception originated from get_ws_endpoint() due to websocket response timeout https://github.com/pyppeteer/pyppeteer/blob/ad3a0a7da221a04425cbf0cc92e50e93883b077b/pyppeteer/launcher.py#L225 Lambda code: import os import json import asyncio import logging import boto3 import pyppeteer from pyppeteer import launch logger = logging.getLogger()

Pyppeteer: Browser closed unexpectedly in AWS Lambda

Deadly 提交于 2020-08-05 16:40:34
问题 I'm running into this error in AWS Lambda. It appears that the devtools websocket is not up. Not sure how to fix it. Any ideas? Thanks for your time. Exception originated from get_ws_endpoint() due to websocket response timeout https://github.com/pyppeteer/pyppeteer/blob/ad3a0a7da221a04425cbf0cc92e50e93883b077b/pyppeteer/launcher.py#L225 Lambda code: import os import json import asyncio import logging import boto3 import pyppeteer from pyppeteer import launch logger = logging.getLogger()

为 React 开发人员推荐 8 个测试工具、库和框架

时光总嘲笑我的痴心妄想 提交于 2020-07-29 00:54:12
云栖号资讯:【 点击查看更多行业资讯 】 在这里您可以找到不同行业的第一手的上云资讯,还在等什么,快来! 很多开发人员都很喜欢 React,在前端领域它也是很流行的 UI 库了。我们也知道应用要交付生产环境前是必须要经过完善的测试的,而测试应用程序时,有趁手的工具能极大减轻开发人员的负担、提升测试效率并减少测试漏洞。正所谓"工欲善其事,必先利其器",这篇文章就为大家推荐 8 个好用的测试工具、库和框架。本文编译自 GeeksforGeeks 网站。 如果你是前端工程师,日常工作中经常会用到 React 库,那么你手里可能已经有一些用来测试 React 应用的工具或框架了。许多开发人员会使用 Jest、Enzyme 或其他一些流行的工具和库来测试 React 应用组件。但毕竟萝卜青菜各有所爱,开源生态系统中又有大量用于 React 应用的测试框架和工具,所以很多人(尤其是新人)很容易在这个问题上犯选择困难症。下面我们会介绍一些流行好用的 React 测试框架和库,供大家参考。 1.Jest Jest 是最受欢迎的测试框架,每周下载超过 1600 万次。它是由 Facebook 创建和维护的。FB 团队用它来测试所有 JavaScript 代码,也包括 React 应用程序。Airbnb、Uber、Intuit 等公司的团队也在用它。Jest 附带了测试运行器和断言功能。就算是刚刚接触

618前端竞品分析研究(互动篇)

你说的曾经没有我的故事 提交于 2020-07-28 20:05:41
智能化测试 在互动中经常需要维护 大量的状态 ,对这些状态进行 测试验证成本较高 ,尤其是当有功能变动需要回归测试的时候。为了降低开发测试的成本,在这方面使用 强化学习模拟用户行为 ,在两个方面提效: mock接口 :将学习过程中的状态作为服务接口的测试数据; 回归测试 :根据mock接口数据回溯到特定状态,Puppeteer根据强化学习触发前端操作,模拟真实用户行为; 什么是强化学习呢? 强化学习是机器学习的一个领域,它强调如何基于环境行动,获取最大化的预期利益。强化学习非常适用于近几年比较流行的电商互动机制:做任务/做游戏 -> 得到不同的奖励值 -> 最终目标大奖,在这类型的互动游戏中,奖励是可预期的,用户的目标是使得自己的奖励最大化。这个过程可以抽象为马尔科夫决策模型:玩家(agent)通过不同的交互行为(action),改变游戏(environment)的状态(state),反馈给玩家不同的奖励 (reward);这个过程不断循环迭代, 玩家的最终目标是奖励最大化。 接下来,我们使用比较简单的Q-learning,来实现类似的智能化测试目的。 Q-learning 对于不同状态下,Q-learning的Q(s,a)表示在某一个时刻的s状态下,采取动作a可以得到的收益期望,算法的主要思想是将state和ation构建一张Q-table来存储Q值

puppeteer csdn 登录 [失败, 跨域cookie无法解决]

妖精的绣舞 提交于 2020-07-27 13:49:29
使用 puppeteer 登录csdn 暂时没能解决这个问题 滑块可以滑到右边 原因在于cookie const puppeteer = require('puppeteer'); const uid = '==='; const pwd = '==='; (async () => { const browser = await puppeteer.launch({ headless: true, //有浏览器界面启动\ // headless: false, //有浏览器界面启动\ // executablePath: '/path/to/Chrome' // slowMo: 100, //放慢浏览器执行速度,方便测试观察 // args: [ //启动 Chrome 的参数,详见上文中的介绍 // // '–no-sandbox', // '--disable-web-security', // "--allow-cross-origin-auth-prompt", // "--process-per-site" // // '--window-size=1280,960' // ], // ignoreDefaultArgs: ["--enable-automation"], // 貌似会清空数据...简直了, 而且必须关闭浏览器 // userDataDir: "C:

I am having toruble installing the puppeteer library

巧了我就是萌 提交于 2020-07-23 06:32:34
问题 I am trying to build a simple web scraper and the first thing I have to do is install the puppeteer library. So I run the commands (I am on the latest linux Mint): sudo npm init -y and sudo npm i puppeteer but I get these errors: ▌ ╢░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟ WARN engine puppeteer@3.0.2: wanted: {"node":">=10.18.1"} (current: {"node":"8.10.0","npm":"3.5.2"}) loadDep:ws → request ▄ ╢███████████████████████████░░░░░░░░░░░░░░░░╟ > puppeteer@3.0.2 install