// Licensed to the Software Freedom Conservancy (SFC) under one1// or more contributor license agreements. See the NOTICE file2// distributed with this work for additional information3// regarding copyright ownership. The SFC licenses this file4// to you under the Apache License, Version 2.0 (the5// "License"); you may not use this file except in compliance6// with the License. You may obtain a copy of the License at7//8// http://www.apache.org/licenses/LICENSE-2.09//10// Unless required by applicable law or agreed to in writing,11// software distributed under the License is distributed on an12// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY13// KIND, either express or implied. See the License for the14// specific language governing permissions and limitations15// under the License.1617/**18* @fileoverview Bootstrap file that loads all of the WebDriver scripts in the19* correct order. Once loaded, pages can use {@code goog.require} statements20* from Google DocType to load additional files as needed.21*22* Example Usage:23*24* <html>25* <head>26* <script src="webdriver-bootstrap.js"></script>27* <script>28* goog.require('goog.debug.Logger');29* </script>30* <script>31* window.onload = function() {32* goog.debug.Logger.getLogger('').info(33* 'The page has finished loading');34* };35* </script>36* </head>37* <body></body>38* </html>39* @author [email protected] (Jason Leyba)40*/4142(function() {43// goog.provide will do this for us, but this makes the IDE stop complaining44// about an undefined symbol.45window.webdriver = {};4647let scripts = document.getElementsByTagName('script');48let directoryPath = './';49let thisFile = 'webdriver-bootstrap.js';5051for (let i = 0; i < scripts.length; i++) {52let src = scripts[i].src;53let len = src.length;54if (src.substr(len - thisFile.length) == thisFile) {55directoryPath = src.substr(0, len - thisFile.length);56break;57}58}5960// All of the files to load. Files are specified in the order they must be61// loaded, NOT alphabetical order.62const webdriverFiles = [63'../../third_party/closure/goog/base.js',64'deps.js'65];6667for (let j = 0; j < webdriverFiles.length; j++) {68document.write('<script type="text/javascript" src="' +69directoryPath + webdriverFiles[j] + '"></script>');70}71})();727374