github.com/bazelbuild/rules_webtesting@v0.2.0/go/wsl/main/main.go (about) 1 // Copyright 2018 Google Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // WSL (Webdriver Server Light) is a lightweight replacement for Selenium Server. 16 package main 17 18 import ( 19 "flag" 20 "log" 21 "os" 22 23 "github.com/bazelbuild/rules_webtesting/go/wsl" 24 ) 25 26 var ( 27 port = flag.Int("port", 4444, "Port to start WSL on.") 28 downloadRoot = flag.String("download_root", "", "Directory served at /google/staticfile/.") 29 uploadRoot = flag.String("upload_root", "", "Directory to which files sent to /session/<id>/upload will be uploaded.") 30 logFile = flag.String("log_file", "", "File for WSL logs.") 31 localHost = flag.String("local_host", "localhost", "Name to use for localhost.") 32 ) 33 34 func main() { 35 flag.Parse() 36 37 if *logFile != "" { 38 out, err := os.Create(*logFile) 39 if err != nil { 40 log.Fatalf("unable to open log file: %v", err) 41 } 42 defer out.Close() 43 log.SetOutput(out) 44 } 45 46 log.SetFlags(log.Flags() | log.Lmicroseconds) 47 wsl.Run(*localHost, *port, *downloadRoot, *uploadRoot) 48 }