Socket
Socket
Sign inDemoInstall

puppeteer

Package Overview
Dependencies
Maintainers
3
Versions
900
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

puppeteer - npm Package Compare versions

Comparing version 1.0.0-next.1514951743425 to 1.0.0-next.1515022965203

27

lib/ElementHandle.js

@@ -198,17 +198,26 @@ /**

* @param {string} expression
* @return {!Promise<?ElementHandle>}
* @return {!Promise<!Array<!ElementHandle>>}
*/
async xpath(expression) {
const handle = await this.executionContext().evaluateHandle(
async $x(expression) {
const arrayHandle = await this.executionContext().evaluateHandle(
(element, expression) => {
const document = element.ownerDocument || element;
return document.evaluate(expression, element, null, XPathResult.FIRST_ORDERED_NODE_TYPE).singleNodeValue;
const iterator = document.evaluate(expression, element, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE);
const array = [];
let item;
while ((item = iterator.iterateNext()))
array.push(item);
return array;
},
this, expression
);
const element = handle.asElement();
if (element)
return element;
await handle.dispose();
return null;
const properties = await arrayHandle.getProperties();
await arrayHandle.dispose();
const result = [];
for (const property of properties.values()) {
const elementHandle = property.asElement();
if (elementHandle)
result.push(elementHandle);
}
return result;
}

@@ -215,0 +224,0 @@ }

@@ -310,7 +310,7 @@ /**

* @param {string} expression
* @return {!Promise<?ElementHandle>}
* @return {!Promise<!Array<!ElementHandle>>}
*/
async xpath(expression) {
async $x(expression) {
const document = await this._document();
const value = await document.xpath(expression);
const value = await document.$x(expression);
return value;

@@ -317,0 +317,0 @@ }

@@ -242,6 +242,6 @@ /**

* @param {string} expression
* @return {!Promise<?Puppeteer.ElementHandle>}
* @return {!Promise<!Array<!Puppeteer.ElementHandle>>}
*/
async xpath(expression) {
return this.mainFrame().xpath(expression);
async $x(expression) {
return this.mainFrame().$x(expression);
}

@@ -248,0 +248,0 @@

{
"name": "puppeteer",
"version": "1.0.0-next.1514951743425",
"version": "1.0.0-next.1515022965203",
"description": "A high-level API to control headless Chrome over the DevTools Protocol",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc