#!/usr/bin/env node /** * Copyright (c) Microsoft Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* eslint-disable no-console */ import * as path from 'path'; import * as program from 'commander'; import * as os from 'os'; import * as fs from 'fs'; import * as consoleApiSource from '../generated/consoleApiSource'; import { OutputMultiplexer, TerminalOutput, FileOutput } from './codegen/outputs'; import { CodeGenerator, CodeGeneratorOutput } from './codegen/codeGenerator'; import { JavaScriptLanguageGenerator, LanguageGenerator } from './codegen/languages'; import { PythonLanguageGenerator } from './codegen/languages/python'; import { CSharpLanguageGenerator } from './codegen/languages/csharp'; import { RecorderController } from './codegen/recorderController'; import { runServer, printApiJson, installBrowsers } from './driver'; import type { Browser, BrowserContext, Page, BrowserType, BrowserContextOptions, LaunchOptions } from '../..'; import * as playwright from '../..'; program .version('Version ' + require('../../package.json').version) .option('-b, --browser ', 'browser to use, one of cr, chromium, ff, firefox, wk, webkit', 'chromium') .option('--color-scheme ', 'emulate preferred color scheme, "light" or "dark"') .option('--device ', 'emulate device, for example "iPhone 11"') .option('--geolocation ', 'specify geolocation coordinates, for example "37.819722,-122.478611"') .option('--lang ', 'specify language / locale, for example "en-GB"') .option('--load-storage ', 'load context storage state from the file, previously saved with --save-storage') .option('--proxy-server ', 'specify proxy server, for example "http://myproxy:3128" or "socks5://myproxy:8080"') .option('--save-storage ', 'save context storage state at the end, for later use with --load-storage') .option('--timezone