How to use respond method in Puppeteer

Best JavaScript code snippet using puppeteer

Run Puppeteer automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

db-api.js

Source: db-api.js Github

copy
1"use strict";
2
3const dbConnection = require('../lib/db-connection.js');
4
5module.exports = function database(options) {
6	// input: [{ title: title, description: description, link: link, categories: categories, pubDate: pubDate, date: date }, ...]
7	// output: { successfull: true/false}
8	this.add('role:database,news:add', addNews);
9	// input: { playerId: playerId }
10	// output: { id: id, link: link, headline: headline, newstext: newstext, newsdate: newsdate, pid: pid }
11	this.add('role:database,news:get', getNews);
12	this.add('role:database,players:get', getPlayers);
13	// input: nothing
14	// output: [ {  } ]
15	this.add('role:database,clubs:get', getClubs);
16	this.add('role:database,playerValues:get', getPlayerValues);
17	this.add('role:database,playerValues:add', addPlayerValues)
18	this.add('role:database,player:lookUpPlayerId', lookUpPlayerId);
19	// input: nothing
20	// output: [ { id, pid, complayerid, name, position, clubid, value, valedate }, ... ]
21	this.add('role:database,playerValues:getAll', getAllPlayerValues);
22	this.add('role:database,playerStats:get', getPlayerStats);
23	this.add('role:database,playerStats:add', addPlayerStats);
24	this.add('role:database,playerStats:addAll', addAllPlayerStats);
25	this.add('role:database,game:add', addGame);
26	this.add('role:database,games:get', getGames);
27}
28
29function addNews (msg, respond) {
30	//validation
31	if (!msg.data) {
32		return respond(new Error('data property is not defined as a parameter'));
33	}
34	const news = msg.data;
35	if (Object.prototype.toString.call(news) !== '[object Array]') {
36		return respond(new Error('data parameter should be an array of news'));
37	}
38	dbConnection.addNews(news)
39		.then(status => respond(null, status))
40		.catch(err => respond(err));
41}
42
43function getNews(msg, respond) {
44	//validation
45	if (!msg.data) {
46		return respond(new Error('data property is not defined as a parameter'));
47	}
48	const playerId = msg.data;
49	if (!playerId)
50		return respond(new Error('Please specify the playerId property in the data property of the message'));
51
52	// defer to dbConnection
53	dbConnection.getNews(playerId)
54		.then(news => respond(null, news))
55		.catch(err => respond(err));
56}
57
58function getPlayers (msg, respond) {
59	dbConnection.getPlayers()
60		.then(players => respond(null, players))
61		.catch(err => respond(err));
62}
63
64function getClubs (msg, respond) {
65	dbConnection.getClubs()
66		.then(clubs => respond(null, clubs))
67		.catch(err => respond(err));
68}
69
70function getPlayerValues (msg, respond) {
71	if(!msg.data)
72		return respond(new Error('data property must be defined and it should contain the playerId'));
73	var playerId = msg.data.playerId;
74	if (!playerId)
75		return respond(new Error('Please specify the playerId property in the data property of the message'));
76	var noOfDays = msg.data.noOfDays;
77	if (!noOfDays)
78		return respond(new Error('Please specify the noOfDays property in the data property of the message'));
79	dbConnection.getPlayerValues(playerId, noOfDays)
80		.then(playerValues => respond(null, playerValues))
81		.catch(err => respond(err));
82}
83
84function getAllPlayerValues (msg, respond) {
85	dbConnection.getAllPlayerValues()
86		.then(playerValues => respond(null, playerValues))
87		.catch(err => respond(err));
88}
89
90/**
91 * Api function to add player values
92 * @param {Object} msg.data
93 * @param {number} msg.data.playerId
94 * @param {Array.<Object>} msg.data.values
95 * @param respond
96 * @returns {*}
97 */
98function addPlayerValues (msg, respond) {
99	const dbPromises = [];
100	if(!msg.data)
101		return respond(new Error('data property must be defined and it should contain the playerId and a values array containing {date: date, value: value} objects'));
102	const playerId = msg.data.playerId;
103	if (!playerId)
104		return respond(new Error('Please specify the playerId property in the data property of the message'));
105	const values = msg.data.values;
106	if (!values) {
107		return respond(new Error('The value property of data should be an array containing {quote: Integer, valdate: Date} objects'));
108	}
109	try {
110		const keysCorrect = values.reduce((previous, next) => {
111			return previous && next.quote != undefined && next.valdate != undefined;
112		}, true);
113		if(!keysCorrect) {
114			return respond(new Error('The value property of data should be an array containing {quote: Integer, valdate: Date} objects'));
115		}
116	} catch(err) {
117		return respond(new Error('The value property of data should be an array containing {quote: Integer, valdate: Date} objects'));
118	}
119
120	dbConnection.addPlayerValues(playerId, values)
121		.then(status => respond(null, status))
122		.catch(err =>
123			respond(err));
124}
125
126function lookUpPlayerId (msg, respond) {
127	if(!msg.data)
128		return respond(new Error('data property must be defined and it should contain the comPlayerId'));
129	const comPlayerId = msg.data.comPlayerId;
130	if (!comPlayerId)
131		return respond(new Error('Please specify the comPlayerId property in the data property of the message'));
132	dbConnection.lookUpPlayerId(comPlayerId)
133		.then(playerId => respond(null, playerId))
134		.catch(err => respond(err));
135}
136
137function getPlayerStats (msg, respond) {
138	if(!msg.data) return respond(new Error('data property must be defined and it should contain the comPlayerId'));
139	const playerId = msg.data.playerId;
140	const gameDay = msg.data.gameDay;
141	const seasonStart = msg.data.seasonStart;
142	if (!playerId || typeof playerId !== "number") return respond(new Error('Parameter playerId is not specified or is not a number'));
143	dbConnection.getPlayerStats(playerId, seasonStart, gameDay)
144		.then(stats => respond(null, stats))
145		.catch(err => respond(err));
146}
147
148function addPlayerStats (msg, respond) {
149	if(!msg.data) return respond(new Error('data property must be defined and it should contain the comPlayerId'));
150	const playerId = msg.data.playerId;
151	const gameDay = msg.data.gameDay;
152	const seasonStart = msg.data.seasonStart;
153	const goals = msg.data.goals;
154	const opponentId = msg.data.opponentId;
155	const home = msg.data.home;
156	const cards = msg.data.cards;
157	const subIn = msg.data.subIn;
158	const subOut = msg.data.subOut;
159	const points = msg.data.points;
160
161	if (playerId == null || typeof playerId !== "number") return respond(new Error('Parameter playerId is not specified or is not a number'));
162	if (gameDay ==null || typeof gameDay !== "number") return respond(new Error('Parameter gameDay is not specified or is not a number'));
163	if (seasonStart == null || typeof seasonStart !== "number") return respond(new Error('Parameter seasonStart is not specified or is not a number'));
164	if (goals == null || typeof goals !== "number") return respond(new Error('Parameter goals is not specified or is not a number'));
165	if (!opponentId || typeof opponentId !== "number") return respond(new Error('Parameter opponentId is not specified or is not a number'));
166	if (typeof(home) !== "boolean") return respond(new Error('Parameter home is not specified or is not a boolean'));
167	if (cards && !(cards === "red" || cards === "yellow" || cards === "yellow-red")) return respond(new Error('Parameter cards must be either yellow, yellow-red or red but is ' + cards));
168	if (subIn != null && typeof subIn !== "number") return respond(new Error('Parameter subIn is not a number'));
169	if (subOut != null && typeof subOut !== "number") return respond(new Error('Parameter subOut is not a number'));
170	if (points != null && typeof points !== "number") return respond(new Error('Parameter points is not a number'));
171
172	dbConnection.addPlayerStats({
173		playerId,
174		gameDay,
175		seasonStart,
176		goals,
177		opponentId,
178		home,
179		cards,
180		subIn,
181		subOut,
182		points
183	})
184		.then(status => respond(undefined, status))
185		.catch(err => respond(err));
186}
187
188function addAllPlayerStats (msg, respond) {
189	if(!msg.data) return respond(new Error('data property must be defined and it should contain the comPlayerId'));
190	Promise.all(msg.data.map(playerStat => dbConnection.addPlayerStats(playerStat)))
191		.then(status => respond(undefined, status))
192		.catch(err => respond(err));
193}
194
195function addGame(msg, respond) {
196	if(!msg.data) return respond(new Error('data property must be defined and it should contain the comPlayerId'));
197	const gameDay = msg.data.gameDay;
198	const seasonStart = msg.data.seasonStart;
199	const homeScore = msg.data.homeScore;
200	const guestScore = msg.data.guestScore;
201	const homeClubId = msg.data.homeClubId;
202	const guestClubId = msg.data.guestClubId;
203
204	if(checkIfNumber(gameDay)) return respond(noExistenceOrNoNumberRejection("gameDay"));
205	if(checkIfNumber(seasonStart)) return respond(noExistenceOrNoNumberRejection("seasonStart"));
206	if(checkIfNumber(homeClubId)) return respond(noExistenceOrNoNumberRejection("homeClubId"));
207	if(checkIfNumber(guestClubId)) return respond(noExistenceOrNoNumberRejection("guestClubId"));
208	if(homeScore && checkIfNumber(homeScore)) return respond(noNumberRejection("homeScore"));
209	if(guestScore && checkIfNumber(guestScore)) return respond(noNumberRejection("guestScore"));
210
211	dbConnection.addGame({
212		gameDay,
213		seasonStart,
214		homeScore,
215		guestScore,
216		homeClubId,
217		guestClubId
218	})
219		.then(status => respond(null, status))
220		.catch(err => respond(err));
221}
222
223function getGames(msg, respond) {
224	if(!msg.data) return respond(new Error('data property must be defined and it should contain the comPlayerId'));
225	const seasonStart = msg.data.seasonStart;
226	const gameDay = msg.data.gameDay;
227
228	dbConnection.getGames(seasonStart, gameDay)
229		.then(games => respond(null, games))
230		.catch(err => respond(err));
231}
232
233function checkIfNumber(number) {
234	return number == null || typeof number !== "number"
235}
236
237function noExistenceOrNoNumberRejection(parameter) {
238	return new Error('Parameter ' + parameter + ' is not specified or is not a number');
239}
240
241function noNumberRejection(parameter) {
242	return new Error('Parameter ' + parameter +  ' is not a number');
243}
Full Screen

fake_server_test.js

Source: fake_server_test.js Github

copy
1/*jslint indent: 2, onevar: false, browser: false, regexp: false, browser: true*/
2/*globals testCase,
3          sinon,
4          assert,
5          assertSame,
6          assertEquals,
7          assertTrue,
8          assertFalse,
9          assertNull,
10          assertException,
11          assertNoException,
12          assertUndefined,
13          assertObject,
14          assertFunction*/
15/**
16 * @author Christian Johansen (christian@cjohansen.no)
17 * @license BSD
18 *
19 * Copyright (c) 2010 Christian Johansen
20 */
21
22testCase("ServerCreateTest", {
23  tearDown: function () {
24    this.server.restore();
25  },
26
27  "should return server object": function () {
28    this.server = sinon.fakeServer.create();
29
30    assertObject(this.server);
31    assert(sinon.fakeServer.isPrototypeOf(this.server));
32  },
33
34  "should provide restore method": function () {
35    this.server = sinon.fakeServer.create();
36
37    assertFunction(this.server.restore);
38  },
39
40  "should fake XMLHttpRequest": sinon.test(function () {
41    this.stub(sinon, "useFakeXMLHttpRequest").returns({
42      restore: this.stub()
43    });
44
45    this.server = sinon.fakeServer.create();
46
47    assert(sinon.useFakeXMLHttpRequest.called);
48  }),
49
50  "should mirror FakeXMLHttpRequest restore method": sinon.test(function () {
51    this.server = sinon.fakeServer.create();
52    var restore = this.stub(sinon.FakeXMLHttpRequest, "restore");
53    this.server.restore();
54
55    assert(restore.called);
56  })
57});
58
59testCase("ServerRequestsTest", {
60  setUp: function () {
61    this.server = sinon.fakeServer.create();
62  },
63
64  tearDown: function () {
65    this.server.restore();
66  },
67
68  "should collect objects created with fake XHR": function () {
69    var xhrs = [new sinon.FakeXMLHttpRequest(), new sinon.FakeXMLHttpRequest()];
70
71    assertEquals(xhrs, this.server.requests);
72  },
73
74  "should collect xhr objects through addRequest": function () {
75    this.server.addRequest = sinon.spy();
76    var xhr = new sinon.FakeXMLHttpRequest();
77
78    assert(this.server.addRequest.calledWith(xhr));
79  },
80
81  "should observe onSend on requests": function () {
82    var xhrs = [new sinon.FakeXMLHttpRequest(), new sinon.FakeXMLHttpRequest()];
83
84    assertFunction(xhrs[0].onSend);
85    assertFunction(xhrs[1].onSend);
86  },
87
88  "onSend should call handleRequest with request object": function () {
89    var xhr = new sinon.FakeXMLHttpRequest();
90    xhr.open("GET", "/");
91    sinon.spy(this.server, "handleRequest");
92
93    xhr.send();
94
95    assert(this.server.handleRequest.called);
96    assert(this.server.handleRequest.calledWith(xhr));
97  }
98});
99
100testCase("ServerHandleRequestTest", {
101  setUp: function () {
102    this.server = sinon.fakeServer.create();
103  },
104
105  tearDown: function () {
106    this.server.restore();
107  },
108
109  "should respond to synchronous requests": function () {
110    var xhr = new sinon.FakeXMLHttpRequest();
111    xhr.open("GET", "/", false);
112    sinon.spy(xhr, "respond");
113
114    xhr.send();
115
116    assert(xhr.respond.called);
117  },
118
119  "should not respond to async requests": function () {
120    var xhr = new sinon.FakeXMLHttpRequest();
121    xhr.open("GET", "/", true);
122    sinon.spy(xhr, "respond");
123
124    xhr.send();
125
126    assertFalse(xhr.respond.called);
127  }
128});
129
130testCase("ServerRespondWithTest", {
131  setUp: function () {
132    this.server = sinon.fakeServer.create();
133
134    this.getRootAsync = new sinon.FakeXMLHttpRequest();
135    this.getRootAsync.open("GET", "/", true);
136    this.getRootAsync.send();
137    sinon.spy(this.getRootAsync, "respond");
138
139    this.postRootAsync = new sinon.FakeXMLHttpRequest();
140    this.postRootAsync.open("POST", "/", true);
141    this.postRootAsync.send();
142    sinon.spy(this.postRootAsync, "respond");
143
144    this.getRootSync = new sinon.FakeXMLHttpRequest();
145    this.getRootSync.open("GET", "/", false);
146
147    this.getPathAsync = new sinon.FakeXMLHttpRequest();
148    this.getPathAsync.open("GET", "/path", true);
149    this.getPathAsync.send();
150    sinon.spy(this.getPathAsync, "respond");
151
152    this.postPathAsync = new sinon.FakeXMLHttpRequest();
153    this.postPathAsync.open("POST", "/path", true);
154    this.postPathAsync.send();
155    sinon.spy(this.postPathAsync, "respond");
156  },
157
158  tearDown: function () {
159    this.server.restore();
160  },
161
162  "should respond to queued async requests": function () {
163    this.server.respondWith("Oh yeah! Duffman!");
164
165    this.server.respond();
166
167    assert(this.getRootAsync.respond.called);
168    assertEquals([200, {}, "Oh yeah! Duffman!"], this.getRootAsync.respond.args[0]);
169  },
170
171  "should respond to all queued async requests": function () {
172    this.server.respondWith("Oh yeah! Duffman!");
173
174    this.server.respond();
175
176    assert(this.getRootAsync.respond.called);
177    assert(this.getPathAsync.respond.called);
178  },
179
180  "should respond with status, headers, and body": function () {
181    var headers = { "Content-Type": "X-test" };
182    this.server.respondWith([201, headers, "Oh yeah!"]);
183
184    this.server.respond();
185
186    assertEquals([201, headers, "Oh yeah!"], this.getRootAsync.respond.args[0]);
187  },
188
189  "should handle responding with empty queue": function () {
190    delete this.server.queue;
191    var server = this.server;
192
193    assertNoException(function () {
194      server.respond();
195    });
196  },
197
198  "should respond to sync request with canned answers": function () {
199    this.server.respondWith([210, { "X-Ops": "Yeah" }, "Body, man"]);
200
201    this.getRootSync.send();
202
203    assertEquals(210, this.getRootSync.status);
204    assertEquals({ "x-ops": "Yeah" }, this.getRootSync.getAllResponseHeaders());
205    assertEquals("Body, man", this.getRootSync.responseText);
206  },
207
208  "should respond to sync request with 404 if no response is set": function () {
209    this.getRootSync.send();
210
211    assertEquals(404, this.getRootSync.status);
212    assertEquals({}, this.getRootSync.getAllResponseHeaders());
213    assertEquals("", this.getRootSync.responseText);
214  },
215
216  "should respond to async request with 404 if no response is set": function () {
217    this.server.respond();
218
219    assertEquals([404, {}, ""], this.getRootAsync.respond.args[0]);
220  },
221
222  "should respond to specific URL": function () {
223    this.server.respondWith("/path", "Duffman likes Duff beer");
224
225    this.server.respond();
226
227    assertEquals([404, {}, ""], this.getRootAsync.respond.args[0]);
228    assertEquals([200, {}, "Duffman likes Duff beer"], this.getPathAsync.respond.args[0]);
229  },
230
231  "should respond to URL matched by regexp": function () {
232    this.server.respondWith(/^\/p.*/, "Regexp");
233
234    this.server.respond();
235
236    assertEquals([200, {}, "Regexp"], this.getPathAsync.respond.args[0]);
237  },
238
239  "should not respond to URL not matched by regexp": function () {
240    this.server.respondWith(/^\/p.*/, "No regexp match");
241
242    this.server.respond();
243
244    assertEquals([404, {}, ""], this.getRootAsync.respond.args[0]);
245  },
246
247  "should respond to all URLs matched by regexp": function () {
248    this.server.respondWith(/^\/.*/, "Match all URLs");
249
250    this.server.respond();
251
252    assertEquals([200, {}, "Match all URLs"], this.getRootAsync.respond.args[0]);
253    assertEquals([200, {}, "Match all URLs"], this.getPathAsync.respond.args[0]);
254  },
255
256  "should respond to all requests when match URL is falsy": function () {
257    this.server.respondWith("", "Falsy URL");
258
259    this.server.respond();
260
261    assertEquals([200, {}, "Falsy URL"], this.getRootAsync.respond.args[0]);
262    assertEquals([200, {}, "Falsy URL"], this.getPathAsync.respond.args[0]);
263  },
264
265  "should respond to all GET requests": function () {
266    this.server.respondWith("GET", "", "All GETs");
267
268    this.server.respond();
269
270    assertEquals([200, {}, "All GETs"], this.getRootAsync.respond.args[0]);
271    assertEquals([200, {}, "All GETs"], this.getPathAsync.respond.args[0]);
272    assertEquals([404, {}, ""], this.postRootAsync.respond.args[0]);
273    assertEquals([404, {}, ""], this.postPathAsync.respond.args[0]);
274  },
275
276  "should respond to all 'get' requests (case-insensitivity)": function () {
277    this.server.respondWith("get", "", "All GETs");
278
279    this.server.respond();
280
281    assertEquals([200, {}, "All GETs"], this.getRootAsync.respond.args[0]);
282    assertEquals([200, {}, "All GETs"], this.getPathAsync.respond.args[0]);
283    assertEquals([404, {}, ""], this.postRootAsync.respond.args[0]);
284    assertEquals([404, {}, ""], this.postPathAsync.respond.args[0]);
285  },
286
287  "should respond to all PUT requests": function () {
288    this.server.respondWith("PUT", "", "All PUTs");
289
290    this.server.respond();
291
292    assertEquals([404, {}, ""], this.getRootAsync.respond.args[0]);
293    assertEquals([404, {}, ""], this.getPathAsync.respond.args[0]);
294    assertEquals([404, {}, ""], this.postRootAsync.respond.args[0]);
295    assertEquals([404, {}, ""], this.postPathAsync.respond.args[0]);
296  },
297
298  "should respond to all POST requests": function () {
299    this.server.respondWith("POST", "", "All POSTs");
300
301    this.server.respond();
302
303    assertEquals([404, {}, ""], this.getRootAsync.respond.args[0]);
304    assertEquals([404, {}, ""], this.getPathAsync.respond.args[0]);
305    assertEquals([200, {}, "All POSTs"], this.postRootAsync.respond.args[0]);
306    assertEquals([200, {}, "All POSTs"], this.postPathAsync.respond.args[0]);
307  },
308
309  "should respond to all POST requests to /path": function () {
310    this.server.respondWith("POST", "/path", "All POSTs");
311
312    this.server.respond();
313
314    assertEquals([404, {}, ""], this.getRootAsync.respond.args[0]);
315    assertEquals([404, {}, ""], this.getPathAsync.respond.args[0]);
316    assertEquals([404, {}, ""], this.postRootAsync.respond.args[0]);
317    assertEquals([200, {}, "All POSTs"], this.postPathAsync.respond.args[0]);
318  },
319
320  "should respond to all POST requests matching regexp": function () {
321    this.server.respondWith("POST", /^\/path(\?.*)?/, "All POSTs");
322
323    this.server.respond();
324
325    assertEquals([404, {}, ""], this.getRootAsync.respond.args[0]);
326    assertEquals([404, {}, ""], this.getPathAsync.respond.args[0]);
327    assertEquals([404, {}, ""], this.postRootAsync.respond.args[0]);
328    assertEquals([200, {}, "All POSTs"], this.postPathAsync.respond.args[0]);
329  },
330
331  "should not respond to aborted requests": function () {
332    this.server.respondWith("/", "That's my homepage!");
333    this.getRootAsync.aborted = true;
334
335    this.server.respond();
336
337    assertFalse(this.getRootAsync.respond.called);
338  },
339
340  "should reset requests": function () {
341    this.server.respondWith("/", "That's my homepage!");
342
343    this.server.respond();
344
345    assertEquals([], this.server.queue);
346  },
347
348  "should notify all requests when some throw": function () {
349    this.getRootAsync.respond = function () {
350      throw new Error("Oops!");
351    };
352
353    this.server.respondWith("");
354    this.server.respond();
355
356    assertEquals([200, {}, ""], this.getPathAsync.respond.args[0]);
357    assertEquals([200, {}, ""], this.postRootAsync.respond.args[0]);
358    assertEquals([200, {}, ""], this.postPathAsync.respond.args[0]);
359  }
360});
361
362testCase("ServerRespondFakeHTTPVerbTest", {
363  setUp: function () {
364    this.server = sinon.fakeServer.create();
365
366    this.request = new sinon.FakeXMLHttpRequest();
367    this.request.open("post", "/path", true);
368    this.request.send("_method=delete");
369    sinon.spy(this.request, "respond");
370  },
371
372  tearDown: function () {
373    this.server.restore();
374  },
375
376  "should not respond to DELETE request with _method parameter": function () {
377    this.server.respondWith("DELETE", "", "");
378
379    this.server.respond();
380
381    assertEquals([404, {}, ""], this.request.respond.args[0]);
382  },
383
384  "should respond to 'fake' DELETE request": function () {
385    this.server.fakeHTTPMethods = true;
386    this.server.respondWith("DELETE", "", "OK");
387
388    this.server.respond();
389
390    assertEquals([200, {}, "OK"], this.request.respond.args[0]);
391  },
392
393  "should not respond to POST when faking DELETE": function () {
394    this.server.fakeHTTPMethods = true;
395    this.server.respondWith("POST", "", "OK");
396
397    this.server.respond();
398
399    assertEquals([404, {}, ""], this.request.respond.args[0]);
400  },
401
402  "should not fake method when not POSTing": function () {
403    this.server.fakeHTTPMethods = true;
404    this.server.respondWith("DELETE", "", "OK");
405
406    var request = new sinon.FakeXMLHttpRequest();
407    request.open("GET", "/");
408    request.send();
409    request.respond = sinon.spy();
410    this.server.respond();
411
412    assertEquals([404, {}, ""], request.respond.args[0]);
413  },
414
415  "should customize HTTP method extraction": function () {
416    this.server.getHTTPMethod = function (request) {
417      return "PUT";
418    };
419
420    this.server.respondWith("PUT", "", "OK");
421
422    this.server.respond();
423
424    assertEquals([200, {}, "OK"], this.request.respond.args[0]);
425  }
426});
427
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Run JavaScript Tests on LambdaTest Cloud Grid

Execute automation tests with Puppeteer on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)