SeleniumHQ/selenium · error · Error

Expected input and output file paths

Error message

Expected input and output file paths

What it means

wrap-find-elements-as-global.js mirrors wrap-as-global.js but for the findElements TypeScript atom, exposing it as window.bot.locators.typescript.findElements. It requires two positional CLI args [inputPath, outputPath] and throws before file I/O if either is absent. Build-time helper invoked by Bazel, not user-facing.

Source

Thrown at javascript/atoms/typescript/wrap-find-elements-as-global.js:27

//   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.

// Wraps the compiled findElements TypeScript output as a browser global so that
// test HTML pages can load it directly via <script> and access it as
// window.bot.locators.typescript.findElements.

const fs = require('node:fs')

const [inputPath, outputPath] = process.argv.slice(2)

if (!inputPath || !outputPath) {
  throw new Error('Expected input and output file paths')
}

const licenseHeader = `// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The SFC licenses this file
// to you 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.`

View on GitHub (pinned to aa36b38e69)

Solutions

  1. Invoke as: node wrap-find-elements-as-global.js <compiled-input.js> <wrapped-output.js>.
  2. Verify both $(location) expansions in the Bazel rule resolve to real files.
  3. Confirm the upstream compile produced the input file.
  4. Prefer running the Bazel target rather than the script directly.

Example fix

// before
node javascript/atoms/typescript/wrap-find-elements-as-global.js find-elements.compiled.js

// after
node javascript/atoms/typescript/wrap-find-elements-as-global.js find-elements.compiled.js find-elements.global.js
Defensive patterns

Strategy: validation

Validate before calling

const [inputPath, outputPath] = process.argv.slice(2)
if (!inputPath || !outputPath) {
  console.error('Usage: wrap-find-elements-as-global.js <input.js> <output.js>')
  process.exit(2)
}

Prevention

When it happens

Trigger: Running the script with zero or one argument. A Bazel macro that fails to substitute both $(location) labels for the findElements target. Passing undefined from a misconfigured rule.

Common situations: Editing the findElements atom BUILD file and dropping one path argument. Manual invocation during debugging. A target rename that breaks location expansion.

Related errors


AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14). Data as JSON: /api/errors/bfb2262ca931638e. Report an issue: GitHub.