Best JavaScript code snippet using playwright-internal
parse-css.js
Source:parse-css.js
...190 reconsume();191 return consumeANumericToken();192 } else if(next(1) == 0x2d && next(2) == 0x3e) {193 consume(2);194 return new CDCToken();195 } else if(startsWithAnIdentifier()) {196 reconsume();197 return consumeAnIdentlikeToken();198 } else {199 return new DelimToken(code);200 }201 }202 else if(code == 0x2e) {203 if(startsWithANumber()) {204 reconsume();205 return consumeANumericToken();206 } else {207 return new DelimToken(code);208 }209 }210 else if(code == 0x3a) return new ColonToken;211 else if(code == 0x3b) return new SemicolonToken;212 else if(code == 0x3c) {213 if(next(1) == 0x21 && next(2) == 0x2d && next(3) == 0x2d) {214 consume(3);215 return new CDOToken();216 } else {217 return new DelimToken(code);218 }219 }220 else if(code == 0x40) {221 if(wouldStartAnIdentifier(next(1), next(2), next(3))) {222 return new AtKeywordToken(consumeAName());223 } else {224 return new DelimToken(code);225 }226 }227 else if(code == 0x5b) return new OpenSquareToken();228 else if(code == 0x5c) {229 if(startsWithAValidEscape()) {230 reconsume();231 return consumeAnIdentlikeToken();232 } else {233 parseerror();234 return new DelimToken(code);235 }236 }237 else if(code == 0x5d) return new CloseSquareToken();238 else if(code == 0x5e) {239 if(next() == 0x3d) {240 consume();241 return new PrefixMatchToken();242 } else {243 return new DelimToken(code);244 }245 }246 else if(code == 0x7b) return new OpenCurlyToken();247 else if(code == 0x7c) {248 if(next() == 0x3d) {249 consume();250 return new DashMatchToken();251 // } else if(next() == 0x7c) {252 // consume();253 // return new ColumnToken();254 } else {255 return new DelimToken(code);256 }257 }258 else if(code == 0x7d) return new CloseCurlyToken();259 else if(code == 0x7e) {260 if(next() == 0x3d) {261 consume();262 return new IncludeMatchToken();263 } else {264 return new DelimToken(code);265 }266 }267 else if(digit(code)) {268 reconsume();269 return consumeANumericToken();270 }271 else if(namestartchar(code)) {272 reconsume();273 return consumeAnIdentlikeToken();274 }275 else if(eof()) return new EOFToken();276 else return new DelimToken(code);277 };278 var consumeAComment = function() {279 consume();280 var comment = "";281 while(true) {282 consume();283 if(code == 0x2a && next() == 0x2f) {284 consume();285 break;286 } else if(eof()) {287 break;288 }289 comment += stringFromCode(code);290 }291 return new CommentToken(comment);292 };293 var consumeANumericToken = function() {294 var num = consumeANumber();295 var token;296 if(wouldStartAnIdentifier(next(1), next(2), next(3))) {297 token = new DimensionToken();298 token.value = num.value;299 token.repr = num.repr;300 token.type = num.type;301 token.unit = consumeAName();302 token.text = token.unit;303 } else if(next() == 0x25) {304 consume();305 token = new PercentageToken();306 token.value = num.value;307 token.repr = num.repr;308 } else {309 var token = new NumberToken();310 token.value = num.value;311 token.repr = num.repr;312 token.type = num.type;313 }314 token.number = token.value;315 token.isInteger = token.type === "integer";316 // FIXME hasSign317 return token;318 };319 var consumeAnIdentlikeToken = function() {320 var str = consumeAName();321 if(str.toLowerCase() == "url" && next() == 0x28) {322 consume();323 while(whitespace(next(1)) && whitespace(next(2)))324 consume();325 if((next() == 0x22 || next() == 0x27) ||326 (whitespace(next()) && (next(2) == 0x22 || next(2) == 0x27))) {327 while(whitespace(next()))328 consume();329 consume();330 let str = consumeAStringToken();331 while(whitespace(next()))332 consume();333 // The closing paren.334 consume();335 return new URLToken(str.text);336 } else {337 return consumeAURLToken();338 }339 } else if(next() == 0x28) {340 consume();341 return new FunctionToken(str);342 } else {343 return new IdentToken(str);344 }345 };346 var consumeAStringToken = function(endingCodePoint) {347 if(endingCodePoint === undefined) endingCodePoint = code;348 var string = "";349 while(consume()) {350 if(code == endingCodePoint || eof()) {351 return new StringToken(string);352 } else if(newline(code)) {353 reconsume();354 return new BadStringToken(string);355 } else if(code == 0x5c) {356 if(eof(next())) {357 donothing();358 } else if(newline(next())) {359 consume();360 } else {361 string += stringFromCode(consumeEscape());362 }363 } else {364 string += stringFromCode(code);365 }366 }367 };368 var consumeAURLToken = function() {369 var token = new URLToken("");370 while(whitespace(next())) consume();371 if(eof(next())) return token;372 while(consume()) {373 if(code == 0x29 || eof()) {374 break;375 } else if(whitespace(code)) {376 while(whitespace(next()))377 consume();378 if(next() == 0x29 || eof(next())) {379 consume();380 break;381 } else {382 consumeTheRemnantsOfABadURL();383 return new BadURLToken();384 }385 } else if(code == 0x22 || code == 0x27 || code == 0x28 || nonprintable(code)) {386 parseerror();387 consumeTheRemnantsOfABadURL();388 return new BadURLToken();389 } else if(code == 0x5c) {390 if(startsWithAValidEscape()) {391 token.value += stringFromCode(consumeEscape());392 } else {393 parseerror();394 consumeTheRemnantsOfABadURL();395 return new BadURLToken();396 }397 } else {398 token.value += stringFromCode(code);399 }400 }401 token.text = token.value;402 return token;403 };404 var consumeEscape = function() {405 // Assume the the current character is the \406 // and the next code point is not a newline.407 consume();408 if(hexdigit(code)) {409 // Consume 1-6 hex digits410 var digits = [code];411 for(var total = 0; total < 5; total++) {412 if(hexdigit(next())) {413 consume();414 digits.push(code);415 } else {416 break;417 }418 }419 if(whitespace(next())) consume();420 var value = parseInt(digits.map(function(x){return String.fromCharCode(x);}).join(''), 16);421 if( value > maximumallowedcodepoint ) value = 0xfffd;422 return value;423 } else if(eof()) {424 return 0xfffd;425 } else {426 return code;427 }428 };429 var areAValidEscape = function(c1, c2) {430 if(c1 != 0x5c) return false;431 if(newline(c2)) return false;432 return true;433 };434 var startsWithAValidEscape = function() {435 return areAValidEscape(code, next());436 };437 var wouldStartAnIdentifier = function(c1, c2, c3) {438 if(c1 == 0x2d) {439 return namestartchar(c2) || c2 == 0x2d || areAValidEscape(c2, c3);440 } else if(namestartchar(c1)) {441 return true;442 } else if(c1 == 0x5c) {443 return areAValidEscape(c1, c2);444 } else {445 return false;446 }447 };448 var startsWithAnIdentifier = function() {449 return wouldStartAnIdentifier(code, next(1), next(2));450 };451 var wouldStartANumber = function(c1, c2, c3) {452 if(c1 == 0x2b || c1 == 0x2d) {453 if(digit(c2)) return true;454 if(c2 == 0x2e && digit(c3)) return true;455 return false;456 } else if(c1 == 0x2e) {457 if(digit(c2)) return true;458 return false;459 } else if(digit(c1)) {460 return true;461 } else {462 return false;463 }464 };465 var startsWithANumber = function() {466 return wouldStartANumber(code, next(1), next(2));467 };468 var consumeAName = function() {469 var result = "";470 while(consume()) {471 if(namechar(code)) {472 result += stringFromCode(code);473 } else if(startsWithAValidEscape()) {474 result += stringFromCode(consumeEscape());475 } else {476 reconsume();477 return result;478 }479 }480 };481 var consumeANumber = function() {482 var repr = [];483 var type = "integer";484 if(next() == 0x2b || next() == 0x2d) {485 consume();486 repr += stringFromCode(code);487 }488 while(digit(next())) {489 consume();490 repr += stringFromCode(code);491 }492 if(next(1) == 0x2e && digit(next(2))) {493 consume();494 repr += stringFromCode(code);495 consume();496 repr += stringFromCode(code);497 type = "number";498 while(digit(next())) {499 consume();500 repr += stringFromCode(code);501 }502 }503 var c1 = next(1), c2 = next(2), c3 = next(3);504 if((c1 == 0x45 || c1 == 0x65) && digit(c2)) {505 consume();506 repr += stringFromCode(code);507 consume();508 repr += stringFromCode(code);509 type = "number";510 while(digit(next())) {511 consume();512 repr += stringFromCode(code);513 }514 } else if((c1 == 0x45 || c1 == 0x65) && (c2 == 0x2b || c2 == 0x2d) && digit(c3)) {515 consume();516 repr += stringFromCode(code);517 consume();518 repr += stringFromCode(code);519 consume();520 repr += stringFromCode(code);521 type = "number";522 while(digit(next())) {523 consume();524 repr += stringFromCode(code);525 }526 }527 var value = convertAStringToANumber(repr);528 return {type:type, value:value, repr:repr};529 };530 var convertAStringToANumber = function(string) {531 // CSS's number rules are identical to JS, afaik.532 return +string;533 };534 var consumeTheRemnantsOfABadURL = function() {535 while(consume()) {536 if(code == 0x2d || eof()) {537 return;538 } else if(startsWithAValidEscape()) {539 consumeEscape();540 donothing();541 } else {542 donothing();543 }544 }545 };546 var iterationCount = 0;547 while(!eof(next())) {548 var token = consumeAToken();549 if (options.loc) {550 token.loc = {};551 token.loc.start = {line:locStart.line, column:locStart.column};552 token.loc.end = {line:line, column:column};553 }554 if (options.offsets) {555 token.startOffset = offsetStart;556 token.endOffset = i + 1;557 }558 yield token;559 iterationCount++;560 if(iterationCount > str.length*2) return "I'm infinite-looping!";561 }562}563function CSSParserToken() { throw "Abstract Base Class"; }564CSSParserToken.prototype.toJSON = function() {565 return {token: this.tokenType};566};567CSSParserToken.prototype.toString = function() { return this.tokenType; };568CSSParserToken.prototype.toSource = function() { return ''+this; };569function BadStringToken(text) {570 this.text = text;571 return this;572}573BadStringToken.prototype = Object.create(CSSParserToken.prototype);574BadStringToken.prototype.tokenType = "bad_string";575function BadURLToken() { return this; }576BadURLToken.prototype = Object.create(CSSParserToken.prototype);577BadURLToken.prototype.tokenType = "bad_url";578function WhitespaceToken() { return this; }579WhitespaceToken.prototype = Object.create(CSSParserToken.prototype);580WhitespaceToken.prototype.tokenType = "whitespace";581WhitespaceToken.prototype.toString = function() { return "WS"; };582WhitespaceToken.prototype.toSource = function() { return " "; };583function CDOToken() { return this; }584CDOToken.prototype = Object.create(CSSParserToken.prototype);585CDOToken.prototype.tokenType = "htmlcomment";586CDOToken.prototype.toSource = function() { return "<!--"; };587function CDCToken() { return this; }588CDCToken.prototype = Object.create(CSSParserToken.prototype);589CDCToken.prototype.tokenType = "htmlcomment";590CDCToken.prototype.toSource = function() { return "-->"; };591function ColonToken() { return this; }592ColonToken.prototype = Object.create(CSSParserToken.prototype);593ColonToken.prototype.tokenType = "symbol";594ColonToken.prototype.text = ":";595function SemicolonToken() { return this; }596SemicolonToken.prototype = Object.create(CSSParserToken.prototype);597SemicolonToken.prototype.tokenType = "symbol";598SemicolonToken.prototype.text = ";";599function CommaToken() { return this; }600CommaToken.prototype = Object.create(CSSParserToken.prototype);601CommaToken.prototype.tokenType = "symbol";...
css-syntax.js
Source:css-syntax.js
...188 reconsume();189 return consumeANumericToken();190 } else if(next(1) == 0x2d && next(2) == 0x3e) {191 consume(2);192 return new CDCToken();193 } else if(startsWithAnIdentifier()) {194 reconsume();195 return consumeAnIdentlikeToken();196 } else {197 return new DelimToken(code);198 }199 }200 else if(code == 0x2e) {201 if(startsWithANumber()) {202 reconsume();203 return consumeANumericToken();204 } else {205 return new DelimToken(code);206 }207 }208 else if(code == 0x3a) return new ColonToken;209 else if(code == 0x3b) return new SemicolonToken;210 else if(code == 0x3c) {211 if(next(1) == 0x21 && next(2) == 0x2d && next(3) == 0x2d) {212 consume(3);213 return new CDOToken();214 } else {215 return new DelimToken(code);216 }217 }218 else if(code == 0x40) {219 if(wouldStartAnIdentifier(next(1), next(2), next(3))) {220 return new AtKeywordToken(consumeAName());221 } else {222 return new DelimToken(code);223 }224 }225 else if(code == 0x5b) return new OpenSquareToken();226 else if(code == 0x5c) {227 if(startsWithAValidEscape()) {228 reconsume();229 return consumeAnIdentlikeToken();230 } else {231 tokenizeerror();232 return new DelimToken(code);233 }234 }235 else if(code == 0x5d) return new CloseSquareToken();236 else if(code == 0x5e) {237 if(next() == 0x3d) {238 consume();239 return new PrefixMatchToken();240 } else {241 return new DelimToken(code);242 }243 }244 else if(code == 0x7b) return new OpenCurlyToken();245 else if(code == 0x7c) {246 if(next() == 0x3d) {247 consume();248 return new DashMatchToken();249 } else if(next() == 0x7c) {250 consume();251 return new ColumnToken();252 } else {253 return new DelimToken(code);254 }255 }256 else if(code == 0x7d) return new CloseCurlyToken();257 else if(code == 0x7e) {258 if(next() == 0x3d) {259 consume();260 return new IncludeMatchToken();261 } else {262 return new DelimToken(code);263 }264 }265 else if(digit(code)) {266 reconsume();267 return consumeANumericToken();268 }269 else if(namestartchar(code)) {270 reconsume();271 return consumeAnIdentlikeToken();272 }273 else if(eof()) return new EOFToken();274 else return new DelimToken(code);275 };276 var consumeComments = function() {277 while(next(1) == 0x2f && next(2) == 0x2a) {278 consume(2);279 while(true) {280 consume();281 if(code == 0x2a && next() == 0x2f) {282 consume();283 break;284 } else if(eof()) {285 tokenizeerror();286 return;287 }288 }289 }290 };291 var consumeANumericToken = function() {292 var num = consumeANumber();293 if(wouldStartAnIdentifier(next(1), next(2), next(3))) {294 var token = new DimensionToken();295 token.value = num.value;296 token.repr = num.repr;297 token.type = num.type;298 token.unit = consumeAName();299 return token;300 } else if(next() == 0x25) {301 consume();302 var token = new PercentageToken();303 token.value = num.value;304 token.repr = num.repr;305 return token;306 } else {307 var token = new NumberToken();308 token.value = num.value;309 token.repr = num.repr;310 token.type = num.type;311 return token;312 }313 };314 var consumeAnIdentlikeToken = function() {315 var str = consumeAName();316 if(str.toLowerCase() == "url" && next() == 0x28) {317 consume();318 while(whitespace(next(1)) && whitespace(next(2))) consume();319 if(next() == 0x22 || next() == 0x27) {320 return new FunctionToken(str);321 } else if(whitespace(next()) && (next(2) == 0x22 || next(2) == 0x27)) {322 return new FunctionToken(str);323 } else {324 return consumeAURLToken();325 }326 } else if(next() == 0x28) {327 consume();328 return new FunctionToken(str);329 } else {330 return new IdentifierToken(str);331 }332 };333 var consumeAStringToken = function(endingCodePoint) {334 if(endingCodePoint === undefined) endingCodePoint = code;335 var string = "";336 while(consume()) {337 if(code == endingCodePoint || eof()) {338 return new StringToken(string);339 } else if(newline(code)) {340 tokenizeerror();341 reconsume();342 return new BadStringToken();343 } else if(code == 0x5c) {344 if(eof(next())) {345 donothing();346 } else if(newline(next())) {347 consume();348 } else {349 string += stringFromCode(consumeEscape())350 }351 } else {352 string += stringFromCode(code);353 }354 }355 };356 var consumeAURLToken = function() {357 var token = new URLToken("");358 while(whitespace(next())) consume();359 if(eof(next())) return token;360 while(consume()) {361 if(code == 0x29 || eof()) {362 return token;363 } else if(whitespace(code)) {364 while(whitespace(next())) consume();365 if(next() == 0x29 || eof(next())) {366 consume();367 return token;368 } else {369 consumeTheRemnantsOfABadURL();370 return new BadURLToken();371 }372 } else if(code == 0x22 || code == 0x27 || code == 0x28 || nonprintable(code)) {373 tokenizeerror();374 consumeTheRemnantsOfABadURL();375 return new BadURLToken();376 } else if(code == 0x5c) {377 if(startsWithAValidEscape()) {378 token.value += stringFromCode(consumeEscape());379 } else {380 tokenizeerror();381 consumeTheRemnantsOfABadURL();382 return new BadURLToken();383 }384 } else {385 token.value += stringFromCode(code);386 }387 }388 };389 var consumeEscape = function() {390 // Assume the the current character is the \391 // and the next code point is not a newline.392 consume();393 if(hexdigit(code)) {394 // Consume 1-6 hex digits395 var digits = [code];396 for(var total = 0; total < 5; total++) {397 if(hexdigit(next())) {398 consume();399 digits.push(code);400 } else {401 break;402 }403 }404 if(whitespace(next())) consume();405 var value = parseInt(digits.map(function(x){return String.fromCharCode(x);}).join(''), 16);406 if( value > maximumallowedcodepoint ) value = 0xfffd;407 return value;408 } else if(eof()) {409 return 0xfffd;410 } else {411 return code;412 }413 };414 var areAValidEscape = function(c1, c2) {415 if(c1 != 0x5c) return false;416 if(newline(c2)) return false;417 return true;418 };419 var startsWithAValidEscape = function() {420 return areAValidEscape(code, next());421 };422 var wouldStartAnIdentifier = function(c1, c2, c3) {423 if(c1 == 0x2d) {424 return namestartchar(c2) || c2 == 0x2d || areAValidEscape(c2, c3);425 } else if(namestartchar(c1)) {426 return true;427 } else if(c1 == 0x5c) {428 return areAValidEscape(c1, c2);429 } else {430 return false;431 }432 };433 var startsWithAnIdentifier = function() {434 return wouldStartAnIdentifier(code, next(1), next(2));435 };436 var wouldStartANumber = function(c1, c2, c3) {437 if(c1 == 0x2b || c1 == 0x2d) {438 if(digit(c2)) return true;439 if(c2 == 0x2e && digit(c3)) return true;440 return false;441 } else if(c1 == 0x2e) {442 if(digit(c2)) return true;443 return false;444 } else if(digit(c1)) {445 return true;446 } else {447 return false;448 }449 };450 var startsWithANumber = function() {451 return wouldStartANumber(code, next(1), next(2));452 };453 var consumeAName = function() {454 var result = "";455 while(consume()) {456 if(namechar(code)) {457 result += stringFromCode(code);458 } else if(startsWithAValidEscape()) {459 result += stringFromCode(consumeEscape());460 } else {461 reconsume();462 return result;463 }464 }465 };466 var consumeANumber = function() {467 var repr = '';468 var type = "integer";469 if(next() == 0x2b || next() == 0x2d) {470 consume();471 repr += stringFromCode(code);472 }473 while(digit(next())) {474 consume();475 repr += stringFromCode(code);476 }477 if(next(1) == 0x2e && digit(next(2))) {478 consume();479 repr += stringFromCode(code);480 consume();481 repr += stringFromCode(code);482 type = "number";483 while(digit(next())) {484 consume();485 repr += stringFromCode(code);486 }487 }488 var c1 = next(1), c2 = next(2), c3 = next(3);489 if((c1 == 0x45 || c1 == 0x65) && digit(c2)) {490 consume();491 repr += stringFromCode(code);492 consume();493 repr += stringFromCode(code);494 type = "number";495 while(digit(next())) {496 consume();497 repr += stringFromCode(code);498 }499 } else if((c1 == 0x45 || c1 == 0x65) && (c2 == 0x2b || c2 == 0x2d) && digit(c3)) {500 consume();501 repr += stringFromCode(code);502 consume();503 repr += stringFromCode(code);504 consume();505 repr += stringFromCode(code);506 type = "number";507 while(digit(next())) {508 consume();509 repr += stringFromCode(code);510 }511 }512 var value = convertAStringToANumber(repr);513 return {type:type, value:value, repr:repr};514 };515 var convertAStringToANumber = function(string) {516 // CSS's number rules are identical to JS, afaik.517 return +string;518 };519 var consumeTheRemnantsOfABadURL = function() {520 while(consume()) {521 if(code == 0x2d || eof()) {522 return;523 } else if(startsWithAValidEscape()) {524 consumeEscape();525 donothing();526 } else {527 donothing();528 }529 }530 };531 var iterationCount = 0;532 while(!eof(next())) {533 tokens.push(consumeAToken());534 if(iterationCount++ > str.length*2) throw new Error("The CSS Tokenizer is infinite-looping");535 }536 return tokens;537}538function CSSParserToken() { return this; }539CSSParserToken.prototype.toJSON = function() {540 return {token: this.tokenType};541}542CSSParserToken.prototype.toString = function() { return this.tokenType; }543CSSParserToken.prototype.toCSSString = function() { return ''+this; }544function BadStringToken() { return this; }545BadStringToken.prototype = new CSSParserToken;546BadStringToken.prototype.tokenType = "BADSTRING";547BadStringToken.prototype.toCSSString = function() { return "'"; }548function BadURLToken() { return this; }549BadURLToken.prototype = new CSSParserToken;550BadURLToken.prototype.tokenType = "BADURL";551BadURLToken.prototype.toCSSString = function() { return "url("; }552function WhitespaceToken() { return this; }553WhitespaceToken.prototype = new CSSParserToken;554WhitespaceToken.prototype.tokenType = "WHITESPACE";555WhitespaceToken.prototype.toString = function() { return "WS"; }556WhitespaceToken.prototype.toCSSString = function() { return " "; }557function CDOToken() { return this; }558CDOToken.prototype = new CSSParserToken;559CDOToken.prototype.tokenType = "CDO";560CDOToken.prototype.toCSSString = function() { return "<!--"; }561function CDCToken() { return this; }562CDCToken.prototype = new CSSParserToken;563CDCToken.prototype.tokenType = "CDC";564CDCToken.prototype.toCSSString = function() { return "-->"; }565function ColonToken() { return this; }566ColonToken.prototype = new CSSParserToken;567ColonToken.prototype.tokenType = ":";568function SemicolonToken() { return this; }569SemicolonToken.prototype = new CSSParserToken;570SemicolonToken.prototype.tokenType = ";";571function CommaToken() { return this; }572CommaToken.prototype = new CSSParserToken;573CommaToken.prototype.tokenType = ",";574CommaToken.prototype.value = ";"; // backwards-compat with DELIM token575function GroupingToken() { return this; }...
cssTokenizer.js
Source:cssTokenizer.js
...188 reconsume();189 return consumeANumericToken();190 } else if(next(1) == 0x2d && next(2) == 0x3e) {191 consume(2);192 return new CDCToken();193 } else if(startsWithAnIdentifier()) {194 reconsume();195 return consumeAnIdentlikeToken();196 } else {197 return new DelimToken(code);198 }199 }200 else if(code == 0x2e) {201 if(startsWithANumber()) {202 reconsume();203 return consumeANumericToken();204 } else {205 return new DelimToken(code);206 }207 }208 else if(code == 0x3a) return new ColonToken;209 else if(code == 0x3b) return new SemicolonToken;210 else if(code == 0x3c) {211 if(next(1) == 0x21 && next(2) == 0x2d && next(3) == 0x2d) {212 consume(3);213 return new CDOToken();214 } else {215 return new DelimToken(code);216 }217 }218 else if(code == 0x40) {219 if(wouldStartAnIdentifier(next(1), next(2), next(3))) {220 return new AtKeywordToken(consumeAName());221 } else {222 return new DelimToken(code);223 }224 }225 else if(code == 0x5b) return new OpenSquareToken();226 else if(code == 0x5c) {227 if(startsWithAValidEscape()) {228 reconsume();229 return consumeAnIdentlikeToken();230 } else {231 parseerror();232 return new DelimToken(code);233 }234 }235 else if(code == 0x5d) return new CloseSquareToken();236 else if(code == 0x5e) {237 if(next() == 0x3d) {238 consume();239 return new PrefixMatchToken();240 } else {241 return new DelimToken(code);242 }243 }244 else if(code == 0x7b) return new OpenCurlyToken();245 else if(code == 0x7c) {246 if(next() == 0x3d) {247 consume();248 return new DashMatchToken();249 } else if(next() == 0x7c) {250 consume();251 return new ColumnToken();252 } else {253 return new DelimToken(code);254 }255 }256 else if(code == 0x7d) return new CloseCurlyToken();257 else if(code == 0x7e) {258 if(next() == 0x3d) {259 consume();260 return new IncludeMatchToken();261 } else {262 return new DelimToken(code);263 }264 }265 else if(digit(code)) {266 reconsume();267 return consumeANumericToken();268 }269 else if(namestartchar(code)) {270 reconsume();271 return consumeAnIdentlikeToken();272 }273 else if(eof()) return new EOFToken();274 else return new DelimToken(code);275 };276 var consumeComments = function() {277 while(next(1) == 0x2f && next(2) == 0x2a) {278 consume(2);279 while(true) {280 consume();281 if(code == 0x2a && next() == 0x2f) {282 consume();283 break;284 } else if(eof()) {285 parseerror();286 return;287 }288 }289 }290 };291 var consumeANumericToken = function() {292 var num = consumeANumber();293 if(wouldStartAnIdentifier(next(1), next(2), next(3))) {294 var token = new DimensionToken();295 token.value = num.value;296 token.repr = num.repr;297 token.type = num.type;298 token.unit = consumeAName();299 return token;300 } else if(next() == 0x25) {301 consume();302 var token = new PercentageToken();303 token.value = num.value;304 token.repr = num.repr;305 return token;306 } else {307 var token = new NumberToken();308 token.value = num.value;309 token.repr = num.repr;310 token.type = num.type;311 return token;312 }313 };314 var consumeAnIdentlikeToken = function() {315 var str = consumeAName();316 if(str.toLowerCase() == "url" && next() == 0x28) {317 consume();318 while(whitespace(next(1)) && whitespace(next(2))) consume();319 if(next() == 0x22 || next() == 0x27) {320 return new FunctionToken(str);321 } else if(whitespace(next()) && (next(2) == 0x22 || next(2) == 0x27)) {322 return new FunctionToken(str);323 } else {324 return consumeAURLToken();325 }326 } else if(next() == 0x28) {327 consume();328 return new FunctionToken(str);329 } else {330 return new IdentToken(str);331 }332 };333 var consumeAStringToken = function(endingCodePoint) {334 if(endingCodePoint === undefined) endingCodePoint = code;335 var string = "";336 while(consume()) {337 if(code == endingCodePoint || eof()) {338 return new StringToken(string);339 } else if(newline(code)) {340 parseerror();341 reconsume();342 return new BadStringToken();343 } else if(code == 0x5c) {344 if(eof(next())) {345 donothing();346 } else if(newline(next())) {347 consume();348 } else {349 string += stringFromCode(consumeEscape())350 }351 } else {352 string += stringFromCode(code);353 }354 }355 };356 var consumeAURLToken = function() {357 var token = new URLToken("");358 while(whitespace(next())) consume();359 if(eof(next())) return token;360 while(consume()) {361 if(code == 0x29 || eof()) {362 return token;363 } else if(whitespace(code)) {364 while(whitespace(next())) consume();365 if(next() == 0x29 || eof(next())) {366 consume();367 return token;368 } else {369 consumeTheRemnantsOfABadURL();370 return new BadURLToken();371 }372 } else if(code == 0x22 || code == 0x27 || code == 0x28 || nonprintable(code)) {373 parseerror();374 consumeTheRemnantsOfABadURL();375 return new BadURLToken();376 } else if(code == 0x5c) {377 if(startsWithAValidEscape()) {378 token.value += stringFromCode(consumeEscape());379 } else {380 parseerror();381 consumeTheRemnantsOfABadURL();382 return new BadURLToken();383 }384 } else {385 token.value += stringFromCode(code);386 }387 }388 };389 var consumeEscape = function() {390 // Assume the the current character is the \391 // and the next code point is not a newline.392 consume();393 if(hexdigit(code)) {394 // Consume 1-6 hex digits395 var digits = [code];396 for(var total = 0; total < 5; total++) {397 if(hexdigit(next())) {398 consume();399 digits.push(code);400 } else {401 break;402 }403 }404 if(whitespace(next())) consume();405 var value = parseInt(digits.map(function(x){return String.fromCharCode(x);}).join(''), 16);406 if( value > maximumallowedcodepoint ) value = 0xfffd;407 return value;408 } else if(eof()) {409 return 0xfffd;410 } else {411 return code;412 }413 };414 var areAValidEscape = function(c1, c2) {415 if(c1 != 0x5c) return false;416 if(newline(c2)) return false;417 return true;418 };419 var startsWithAValidEscape = function() {420 return areAValidEscape(code, next());421 };422 var wouldStartAnIdentifier = function(c1, c2, c3) {423 if(c1 == 0x2d) {424 return namestartchar(c2) || c2 == 0x2d || areAValidEscape(c2, c3);425 } else if(namestartchar(c1)) {426 return true;427 } else if(c1 == 0x5c) {428 return areAValidEscape(c1, c2);429 } else {430 return false;431 }432 };433 var startsWithAnIdentifier = function() {434 return wouldStartAnIdentifier(code, next(1), next(2));435 };436 var wouldStartANumber = function(c1, c2, c3) {437 if(c1 == 0x2b || c1 == 0x2d) {438 if(digit(c2)) return true;439 if(c2 == 0x2e && digit(c3)) return true;440 return false;441 } else if(c1 == 0x2e) {442 if(digit(c2)) return true;443 return false;444 } else if(digit(c1)) {445 return true;446 } else {447 return false;448 }449 };450 var startsWithANumber = function() {451 return wouldStartANumber(code, next(1), next(2));452 };453 var consumeAName = function() {454 var result = "";455 while(consume()) {456 if(namechar(code)) {457 result += stringFromCode(code);458 } else if(startsWithAValidEscape()) {459 result += stringFromCode(consumeEscape());460 } else {461 reconsume();462 return result;463 }464 }465 };466 var consumeANumber = function() {467 var repr = [];468 var type = "integer";469 if(next() == 0x2b || next() == 0x2d) {470 consume();471 repr += stringFromCode(code);472 }473 while(digit(next())) {474 consume();475 repr += stringFromCode(code);476 }477 if(next(1) == 0x2e && digit(next(2))) {478 consume();479 repr += stringFromCode(code);480 consume();481 repr += stringFromCode(code);482 type = "number";483 while(digit(next())) {484 consume();485 repr += stringFromCode(code);486 }487 }488 var c1 = next(1), c2 = next(2), c3 = next(3);489 if((c1 == 0x45 || c1 == 0x65) && digit(c2)) {490 consume();491 repr += stringFromCode(code);492 consume();493 repr += stringFromCode(code);494 type = "number";495 while(digit(next())) {496 consume();497 repr += stringFromCode(code);498 }499 } else if((c1 == 0x45 || c1 == 0x65) && (c2 == 0x2b || c2 == 0x2d) && digit(c3)) {500 consume();501 repr += stringFromCode(code);502 consume();503 repr += stringFromCode(code);504 consume();505 repr += stringFromCode(code);506 type = "number";507 while(digit(next())) {508 consume();509 repr += stringFromCode(code);510 }511 }512 var value = convertAStringToANumber(repr);513 return {type:type, value:value, repr:repr};514 };515 var convertAStringToANumber = function(string) {516 // CSS's number rules are identical to JS, afaik.517 return +string;518 };519 var consumeTheRemnantsOfABadURL = function() {520 while(consume()) {521 if(code == 0x29 || eof()) {522 return;523 } else if(startsWithAValidEscape()) {524 consumeEscape();525 donothing();526 } else {527 donothing();528 }529 }530 };531 var iterationCount = 0;532 while(!eof(next())) {533 tokens.push(consumeAToken());534 iterationCount++;535 if(iterationCount > str.length*2) return "I'm infinite-looping!";536 }537 return tokens;538}539function CSSParserToken() { throw "Abstract Base Class"; }540CSSParserToken.prototype.toJSON = function() {541 return {token: this.tokenType};542}543CSSParserToken.prototype.toString = function() { return this.tokenType; }544CSSParserToken.prototype.toSource = function() { return ''+this; }545function BadStringToken() { return this; }546BadStringToken.prototype = Object.create(CSSParserToken.prototype);547BadStringToken.prototype.tokenType = "BADSTRING";548function BadURLToken() { return this; }549BadURLToken.prototype = Object.create(CSSParserToken.prototype);550BadURLToken.prototype.tokenType = "BADURL";551function WhitespaceToken() { return this; }552WhitespaceToken.prototype = Object.create(CSSParserToken.prototype);553WhitespaceToken.prototype.tokenType = "WHITESPACE";554WhitespaceToken.prototype.toString = function() { return "WS"; }555WhitespaceToken.prototype.toSource = function() { return " "; }556function CDOToken() { return this; }557CDOToken.prototype = Object.create(CSSParserToken.prototype);558CDOToken.prototype.tokenType = "CDO";559CDOToken.prototype.toSource = function() { return "<!--"; }560function CDCToken() { return this; }561CDCToken.prototype = Object.create(CSSParserToken.prototype);562CDCToken.prototype.tokenType = "CDC";563CDCToken.prototype.toSource = function() { return "-->"; }564function ColonToken() { return this; }565ColonToken.prototype = Object.create(CSSParserToken.prototype);566ColonToken.prototype.tokenType = ":";567function SemicolonToken() { return this; }568SemicolonToken.prototype = Object.create(CSSParserToken.prototype);569SemicolonToken.prototype.tokenType = ";";570function CommaToken() { return this; }571CommaToken.prototype = Object.create(CSSParserToken.prototype);572CommaToken.prototype.tokenType = ",";573function GroupingToken() { throw "Abstract Base Class"; }574GroupingToken.prototype = Object.create(CSSParserToken.prototype);...
bot.js
Source:bot.js
1require("./extendedMessage");2const3 Discord = require("discord.js"),4 config = require("../config"),5 { prefix } = require("../config"),6 commandHandler = require("./handlers/commands"),7 client = new Discord.Client({8 messageEditHistoryMaxSize: 0,9 disableMentions: "all",10 partials: ["GUILD_MEMBER", "MESSAGE"],11 presence: {12 status: "dnd",13 activity: {14 type: "WATCHING",15 name: "загÑÑзоÑнÑй ÑкÑан"16 }17 }18 }),19 log = require("./handlers/logger"),20 db = require("./database/")();21global.sleep = ms => new Promise(resolve => setTimeout(resolve, ms));22global.getInvite = require("./constants/").getInvite;23global.msToTime = require("./constants/").msToTime;24global.plurify = require("./constants/").plurify;25global.si = require("systeminformation");26global.fetch = require("node-fetch");27global.root = __dirname;28global.client = client;29global.log = log;30global.db = db;31let shard = "[Shard N/A]";32client.once("shardReady", async (shardid, unavailable = new Set()) => {33 shard = `[Shard ${shardid}]`;34 log.log(`${shard} Ready as ${client.user.tag}! Caching guilds.`);35 client.loading = true;36 let disabledGuilds = new Set([...Array.from(unavailable), ...client.guilds.cache.map(guild => guild.id)]);37 let guildCachingStart = Date.now();38 await db.cacheGuilds(disabledGuilds);39 log.log(`${shard} All ${disabledGuilds.size} guilds have been cached. [${Date.now() - guildCachingStart}ms]`);40 disabledGuilds.size = 0;41 client.loading = false;42 await updatePresence();43 client.setInterval(updatePresence, 10000); // 10 seconds44 if (config.cdcToken && config.topggToken && !config.dev) {45 await sendStats();46 client.setInterval(sendStats, 60 * 60 * 1000); // 60 minutes47 };48});49client.on("message", async message => {50 global.msg = message;51 if (52 !message.guild ||53 message.author.bot ||54 message.type !== "DEFAULT"55 ) return;56 const gdb = await db.guild(message.guild.id);57 global.gdb = gdb;58 global.gldb = db.global;59 if (gldb.get().blacklistedUsers.includes(message.author.id)) return;60 let { prefix } = gdb.get();61 if (!prefix.length) prefix = config.prefix;62 if (message.content.startsWith(prefix) || message.content.match(`^<@!?${client.user.id}> `)) return commandHandler(message, prefix, gdb, db);63 if (message.content.match(`^<@!?${client.user.id}>`)) return message.reply(`ð Ðой пÑеÑÐ¸ÐºÑ Ð½Ð° ÑÑом ÑеÑвеÑе \`${prefix}\`, Ð´Ð»Ñ Ð¿Ð¾Ð¼Ð¾Ñи напиÑиÑе \`${prefix}help\`.`);64});65client.on("guildCreate", async guild => {66 const e = "<a:fuck:868103266662232124>";67 if (gldb.get().blacklistedServers.includes(guild.id)) {68 let owner = await client.users.fetch(guild.ownerID), a = "";69 await owner.send(70 `Я не бÑл добавлен на ÐÐ°Ñ ÑеÑÐ²ÐµÑ **${guild.name}** из-за Ñого, ÑÑо он наÑ
одиÑÑÑ Ð² ЧÑÑном СпиÑке.\n\n` +71 "ÐÑли ÐÑ Ñ
оÑиÑе обжаловаÑÑ ÑÑо, заÑ
одиÑе на Ð½Ð°Ñ ÑеÑÐ²ÐµÑ Ð¿Ð¾Ð´Ð´ÐµÑжки - https://dsc.gg/sof"72 ).catch(() => {73 a = "\n\nÐе ÑдалоÑÑ Ð¾ÑпÑавиÑÑ ÑообÑение в ÐС ÑоздаÑÐµÐ»Ñ ÑеÑвеÑа.";74 });75 await guild.leave();76 return client.channels.cache.get("868094755043704842").send(`${e}New guild${e}, но она в ÑеÑном ÑпиÑке` + a, {77 embed: {78 title: guild.name,79 thumbnail: {80 url: guild.iconURL({ dynamic: true, format: "png", size: 64 })81 },82 fields: [83 {84 name: "УÑаÑÑники",85 value: `\`${guild.memberCount}\``86 }87 ],88 footer: {89 text: `ID: ${guild.id}`90 }91 }92 });93 };94 client.channels.cache.get("868094755043704842").send(`${e}New guild${e}`, {95 embed: {96 title: guild.name,97 thumbnail: {98 url: guild.iconURL({ dynamic: true, format: "png", size: 64 })99 },100 fields: [101 {102 name: "УÑаÑÑники",103 value: `\`${guild.memberCount}\``104 }105 ],106 footer: {107 text: `ID: ${guild.id}`108 }109 }110 });111});112client.on("guildDelete", async guild => {113 const e = "<a:fuck:868103266662232124>";114 client.channels.cache.get("868094755043704842").send(`${e}Guild removed${e}`, {115 embed: {116 title: guild.name,117 thumbnail: {118 url: guild.iconURL({ dynamic: true, format: "png", size: 64 })119 },120 footer: {121 text: `ID: ${guild.id}`122 }123 }124 });125});126const updatePresence = async () => {127 let guildCount = await client.shard.broadcastEval("this.guilds.cache.size").then(res => res.reduce((prev, val) => prev + val, 0));128 let name = `${prefix}help ⢠${plurify(guildCount, "ÑеÑвеÑ")}`;129 return client.user.setPresence({130 status: "online",131 activity: { type: "WATCHING", name }132 });133};134const sendStats = async () => {135 let136 cdcRoute = "https://api.server-discord.com/v2",137 cdcToken = config.cdcToken,138 topggRoute = "https://top.gg/api",139 topggToken = config.topggToken;140 let cdcPost = Date.now();141 //log.log(`Trying to post stats for \`${client.user.tag}\` on ${cdcRoute}`);142 await fetch(cdcRoute + "/bots/:id/stats".replace(":id", client.user.id), {143 method: "POST",144 headers: {145 "Content-Type": "application/json",146 "Authorization": `SDC ${cdcToken}`,147 },148 body: JSON.stringify({149 servers: await client.shard.broadcastEval("this.guilds.cache.size").then(res => res.reduce((prev, val) => prev + val, 0)),150 shards: config.shards151 }),152 }).then(res => {}/*log.log(`Successfully sent stats for \`${client.user.tag}\` [${Date.now() - cdcPost}ms]\n${JSON.stringify(res)}`)*/)153 .catch(err => log.error(err.stack));154 topggPost = Date.now();155 //log.log(`Trying to post stats for \`${client.user.tag}\` on ${topggRoute}`);156 await fetch(topggRoute + "/bots/:id/stats".replace(":id", client.user.id), {157 method: "POST",158 headers: {159 "Content-Type": "application/json",160 "Authorization": topggToken,161 },162 body: JSON.stringify({163 server_count: await client.shard.broadcastEval("this.guilds.cache.size").then(res => res.reduce((prev, val) => prev + val, 0)),164 shard_id: 0,165 shard_count: config.shards166 }),167 }).then(res => {}/*log.log(`Successfully sent stats for \`${client.user.tag}\` [${Date.now() - topggPost}ms]\n${JSON.stringify(res)}`)*/)168 .catch(err => log.error(err.stack));169};170client171 .on("error", err => log.error(`${shard} Client error. ${err}`))172 .on("rateLimit", rateLimitInfo => log.warn(`${shard} Rate limited.\n${JSON.stringify(rateLimitInfo)}`))173 .on("shardDisconnected", closeEvent => log.warn(`${shard} Disconnected. ${closeEvent}`))174 .on("shardError", err => log.error(`${shard} Error. ${err}`))175 .on("shardReconnecting", () => log.log(`${shard} Reconnecting.`))176 .on("shardResume", (_, replayedEvents) => log.log(`${shard} Resumed. ${replayedEvents} replayed events.`))177 .on("warn", info => log.warn(`${shard} Warning. ${info}`))178 .login(config.token);...
cdc.js
Source:cdc.js
1// https://drafts.csswg.org/css-syntax-3/#typedef-cdc-token2'use strict'3const { CDC } = require('./tokens');4module.exports = function composeCDCToken(_1, _2, _3) {5 if (_1 && _1.d === '-') {6 if (_2 && _2.d === '-') {7 if (_3 && _3.d === '>') {8 return {9 id: CDC, 10 d: '-->', 11 s: { o:_1, loc:{ col:_1.col, row: _1.row}},12 e: { o:_3, loc:{ col:_3.col, row: _3.row}}13 }14 }15 }16 }17 return18}
Using AI Code Generation
1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 const token = await page.context().newCDCToken();7 console.log(token);8 await browser.close();9})();10const { chromium } = require('playwright');11(async () => {12 const browser = await chromium.launch();13 const context = await browser.newContext();14 const page = await context.newPage();15 const token = await page.context().newCDCToken();16 console.log(token);17 await browser.close();18})();
Using AI Code Generation
1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext({5 });6 const page = await context.newPage();7 await page.screenshot({ path: `example.png` });8 await context.storageState({ path: './storage-state.json' });9 await browser.close();10})();11const { chromium } = require('playwright');12(async () => {13 const browser = await chromium.launch();14 const context = await browser.newContext({15 });16 const page = await context.newPage();17 await page.screenshot({ path: `example.png` });18 await context.storageState({ path: './storage-state.json' });19 await browser.close();20})();21const { chromium } = require('playwright');22(async () => {23 const browser = await chromium.launch();24 const context = await browser.newContext({25 });26 const page = await context.newPage();27 await page.screenshot({ path: `example.png` });28 await context.storageState({ path: './storage-state.json' });29 await browser.close();30})();31const { chromium } = require('playwright');32(async () => {33 const browser = await chromium.launch();34 const context = await browser.newContext({35 });36 const page = await context.newPage();37 await page.screenshot({ path: `example.png` });38 await context.storageState({ path: './storage-state.json' });39 await browser.close();40})();41const { chromium } = require('playwright');42(async () => {43 const browser = await chromium.launch();44 const context = await browser.newContext({
Using AI Code Generation
1const { CDCToken } = require('playwright-core/lib/server/cdpsession');2const { CDPSession } = require('playwright-core/lib/cdpsession');3const { CDCToken } = require('playwright-core/lib/server/cdpsession');4const { CDPSession } = require('playwright-core/lib/cdpsession');5const { CDCToken } = require('playwright-core/lib/server/cdpsession');6const { CDPSession } = require('playwright-core/lib/cdpsession');7const { CDCToken } = require('playwright-core/lib/server/cdpsession');8const { CDPSession } = require('playwright-core/lib/cdpsession');9const { CDCToken } = require('playwright-core/lib/server/cdpsession');10const { CDPSession } = require('playwright-core/lib/cdpsession');11const { CDCToken } = require('playwright-core/lib/server/cdpsession');12const { CDPSession } = require('playwright-core/lib/cdpsession');13const { CDCToken } = require('playwright-core/lib/server/cdpsession');14const { CDPSession } = require('playwright-core/lib/cdpsession');15const { CDCToken } = require('playwright-core/lib/server/cdpsession');16const { CDPSession } = require('playwright-core/lib/cdpsession');17const { CDCToken } = require('playwright-core/lib/server/cdpsession');18const { CDPSession } = require('playwright-core/lib/cdpsession');19const { CDCToken } = require('playwright-core/lib/server/cdpsession');20const { CDPSession } = require('playwright-core/lib/cdpsession');
Using AI Code Generation
1const {CDCToken} = require('playwright-core/lib/cjs/server/chromium/crConnection');2const {CDPSession} = require('playwright-core/lib/cjs/server/common/webkit/webkitConnection');3const {connect} = require('playwright-core/lib/cjs/server/common/webSocketTransport');4const {CDCToken} = require('playwright-core/lib/cjs/server/chromium/crConnection');5const {CDPSession} = require('playwright-core/lib/cjs/server/common/webkit/webkitConnection');6const {connect} = require('playwright-core/lib/cjs/server/common/webSocketTransport');7(async () => {8 const browser = await chromium.launch();9 const context = await browser.newContext();10 const page = await context.newPage();11 const client = await page.context().newCDPSession(page);12 await client.send('Network.enable');13 await client.send('Network.setExtraHTTPHeaders', { headers: { 'User-Agent': 'Chrome/80.0.3987.149'}});14 await page.goto(url);15 await page.waitForTimeout(10000);16 await page.click('#email');17 await page.fill('#email', 'myemail');18 await page.click('#pass');19 await page.fill('#pass', 'mypassword');20 await page.click('#loginbutton');21 await page.waitForTimeout(10000);22 const cookies = await context.cookies();23 console.log(cookies);24 await client.send('Network.clearBrowserCookies');25 await context.close();26 await browser.close();27})();
Using AI Code Generation
1const { CDCToken } = require('playwright-core/lib/server/cdpsession');2const { connect } = require('playwright-core/lib/server/chromium');3const { createGuid } = require('playwright-core/lib/utils/utils');4const guid = createGuid();5const connection = await connect({6});7const client = connection.rootSession;8const token = new CDCToken(client, 'Network.enable');9await token.send();10await token.dispose();11await connection.close();12const { connect } = require('playwright-core/lib/server/chromium');13const { createGuid } = require('playwright-core/lib/utils/utils');14const guid = createGuid();15const connection = await connect({16});17const client = connection.rootSession;18await client.send('Network.enable');19await connection.close();20const { chromium } = require('playwright-core');21const browser = await chromium.connect({22});23const context = await browser.newContext();24const page = await context.newPage();25await page.screenshot({ path: 'example.png' });26await browser.close();27const { chromium } = require('playwright-core');28const browser = await chromium.connect({29});30const context = await browser.newContext();
Using AI Code Generation
1const { CDCToken } = require('playwright/internal');2const token = CDCToken.create('Network.enable');3await page._delegate.send(token);4const { CDCToken } = require('playwright/internal');5const token = CDCToken.create('Network.enable');6await page._delegate.send(token);7const { CDCToken } = require('playwright/internal');8const token = CDCToken.create('Network.enable');9await page._delegate.send(token);10const { CDCToken } = require('playwright/internal');11const token = CDCToken.create('Network.enable');12await page._delegate.send(token);13const { CDCToken } = require('playwright/internal');14const token = CDCToken.create('Network.enable');15await page._delegate.send(token);16const { CDCToken } = require('playwright/internal');17const token = CDCToken.create('Network.enable');18await page._delegate.send(token);19const { CDCToken } = require('playwright/internal');20const token = CDCToken.create('Network.enable');21await page._delegate.send(token);22const { CDCToken } = require('playwright/internal');23const token = CDCToken.create('Network.enable');24await page._delegate.send(token);25const { CDCToken } = require('playwright/internal');26const token = CDCToken.create('Network.enable');27await page._delegate.send(token);28const { CDCToken } = require('playwright/internal');29const token = CDCToken.create('Network.enable');30await page._delegate.send(token);31const { CDCToken } = require('playwright/internal');32const token = CDCToken.create('Network.enable');33await page._delegate.send(token);34const {
LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.
Get 100 minutes of automation test minutes FREE!!