Uploads file to an element using absolute file path.

For more info on working with DOM elements in Nightwatch, refer to the Finding & interacting with DOM Elements guide page.

Usage

                    browser.element(selector).upload(filePath)
                

Example

export default {
  demoTest(browser: NightwatchAPI): void {
    browser.element('#myFile').upload('/path/file.pdf');
  },

  async demoTestAsync(browser: NightwatchAPI): Promise<void> {
    await browser.element('#myFile').upload('/path/file.pdf');
  }
}

Parameters

Name Type description
file string

The file path to upload.

Returns

Type description
ScopedWebElement