# Class OjFilePicker

The component WebElement for oj-file-picker. Do not instantiate this class directly, instead, use ojFilePicker.

#### Migration

When you migrate a page from using oj-file-picker to oj-c-file-picker you will also need to migrate your WebDriver tests from OjFilePicker to FilePickerWebElement. To do that you will need to revise type and locator instances as follows Type: from OjFilePicker to FilePickerWebElement Locator: from ojFilePicker to findFilePicker For more details on migrating from legacy to core pack please see component's migration section

#### Hierarchy

- OjFilePickerBase
  - OjFilePicker

#####
Index

### Constructors

constructor

### Methods

clear
click
doSelect
findElement
findElements
getAccept
getAttribute
getCapture
getCssValue
getDisabled
getLocation
getPrimaryText
getProperty
getRect
getSecondaryText
getSelectOn
getSelectionMode
getSize
getText
hasSize
hasVisibility
isDisplayed
isEnabled
isSelected
sendKeys
setProperty
submit
takeScreenshot
whenBusyContextReady
whenReady
setupPickFiles

## Constructors

### constructor

- new OjFilePicker(el, locators): OjFilePicker

- Constructor. Pass an instance of WebDriver's WebElement that represents the DOM node on which we"ll perform operations.

  #### Parameters

  - ##### el: WebElement

    The basic WebElement with which this WebElement will work.

  - ##### locators: ElementLocators

  #### Returns OjFilePicker

  Inherited from OjFilePickerBase.constructor

## Methods

### clear

- clear(): Promise<void>

- #### Returns Promise<void>

  #### Inherit Doc

  Inherited from OjFilePickerBase.clear

### click

- click(): Promise<void>

- #### Returns Promise<void>

  #### Inherit Doc

  Inherited from OjFilePickerBase.click

### doSelect

- doSelect(files): Promise<boolean>

- Takes an Array of objects containing file paths + types. These files will be read from the local filesystem and then sent to the oj-file-picker to simulate user file selection. Only the basename of the file will be sent, not the entire path to make it consistent with how the browser sets the value.

  #### Parameters

  - ##### files: {
    path: string;
    type: string;
    }[]

    An array of objects containing the path and type of selected files

  #### Returns Promise<boolean>

### findElement

- findElement(locator): WebElementPromise

- #### Parameters

  - ##### locator: Locator

  #### Returns WebElementPromise

  #### Inherit Doc

  Inherited from OjFilePickerBase.findElement

### findElements

- findElements(locator): Promise<WebElement[]>

- #### Parameters

  - ##### locator: Locator

  #### Returns Promise<WebElement[]>

  #### Inherit Doc

  Inherited from OjFilePickerBase.findElements

### getAccept

- getAccept(): Promise<string[]>

- Gets the value of `accept` property. An array of strings of allowed MIME types or file extensions that can be uploaded. If not specified, accept all file types

  #### Returns Promise<string[]>

  The value of `accept` property.

  Inherited from OjFilePickerBase.getAccept

### getAttribute

- getAttribute(attributeName): Promise<string>

- #### Parameters

  - ##### attributeName: string

  #### Returns Promise<string>

  #### Inherit Doc

  Inherited from OjFilePickerBase.getAttribute

### getCapture

- getCapture(): Promise<string>

- Gets the value of `capture` property. Specifies the preferred facing mode for the device's media capture mechanism.

  #### Returns Promise<string>

  The value of `capture` property.

  Inherited from OjFilePickerBase.getCapture

### getCssValue

- getCssValue(cssStyleProperty): Promise<string>

- #### Parameters

  - ##### cssStyleProperty: string

  #### Returns Promise<string>

  #### Inherit Doc

  Inherited from OjFilePickerBase.getCssValue

### getDisabled

- getDisabled(): Promise<boolean>

- Gets the value of `disabled` property. Disables the filepicker if set to true

  #### Returns Promise<boolean>

  The value of `disabled` property.

  Inherited from OjFilePickerBase.getDisabled

### getLocation

- getLocation(): Promise<ILocation>

- #### Returns Promise<ILocation>

  #### Inherit Doc

  Inherited from OjFilePickerBase.getLocation

### getPrimaryText

- getPrimaryText(): Promise<null | string>

- Gets the value of `primaryText` property. The primary text for the default file picker.

  #### Returns Promise<null | string>

  The value of `primaryText` property.

  Inherited from OjFilePickerBase.getPrimaryText

### getProperty

- getProperty<T>(propertyName): Promise<T>

- Get a named property value from this component. This function will wait for the application's busy context to complete before attempting to get the property value.

  #### Type Parameters

  - #### T = string

  #### Parameters

  - ##### propertyName: string

    The name of the property

  #### Returns Promise<T>

  A Promise that yields a value for the named property.

  Inherited from OjFilePickerBase.getProperty

### getRect

- getRect(): Promise<IRectangle>

- #### Returns Promise<IRectangle>

  #### Inherit Doc

  Inherited from OjFilePickerBase.getRect

### getSecondaryText

- getSecondaryText(): Promise<null | string>

- Gets the value of `secondaryText` property. The secondary text for the default file picker.

  #### Returns Promise<null | string>

  The value of `secondaryText` property.

  Inherited from OjFilePickerBase.getSecondaryText

### getSelectOn

- getSelectOn(): Promise<string>

- Gets the value of `selectOn` property. The type of event to select the files.

  #### Returns Promise<string>

  The value of `selectOn` property.

  #### Deprecated

  Since 13.1.0. Main use case was to turn off drag and drop for button filepicker. The current recommendation for that use case is to use ojfilepickerutils with an oj-button.

  Inherited from OjFilePickerBase.getSelectOn

### getSelectionMode

- getSelectionMode(): Promise<string>

- Gets the value of `selectionMode` property. Whether to allow single or multiple file selection.

  #### Returns Promise<string>

  The value of `selectionMode` property.

  Inherited from OjFilePickerBase.getSelectionMode

### getSize

- getSize(): Promise<ISize>

- #### Returns Promise<ISize>

  #### Inherit Doc

  Inherited from OjFilePickerBase.getSize

### getText

- getText(): Promise<string>

- #### Returns Promise<string>

  #### Inherit Doc

  Inherited from OjFilePickerBase.getText

### `Protected` hasSize

- hasSize(): Condition<Promise<boolean>>

- Create a wait condition that is satisfied when the element's DOM has a non-zero size.

  #### Returns Condition<Promise<boolean>>

  The Condition to be used with driver.wait() that's satisfied when the element's DOM has a non-zero size.

  #### Deprecated

  Since 11.0.0. Call the appropriate WebElement method to test the size of the element.

  Inherited from OjFilePickerBase.hasSize

### `Protected` hasVisibility

- hasVisibility(): Condition<Promise<boolean>>

- Create a wait condition that is satisfid when the element is visible. The condition is satisfied when the element is displayed, as reported by #isDisplayed, and is scrolled into view. This is method is deprecated. Use WebElement.isDisplayed instead to test the display of the element, and scroll it into view if necessary.

  #### Returns Condition<Promise<boolean>>

  #### Deprecated

  Inherited from OjFilePickerBase.hasVisibility

### isDisplayed

- isDisplayed(): Promise<boolean>

- #### Returns Promise<boolean>

  #### Inherit Doc

  Inherited from OjFilePickerBase.isDisplayed

### isEnabled

- isEnabled(): Promise<boolean>

- #### Returns Promise<boolean>

  #### Inherit Doc

  Inherited from OjFilePickerBase.isEnabled

### isSelected

- isSelected(): Promise<boolean>

- #### Returns Promise<boolean>

  #### Inherit Doc

  Inherited from OjFilePickerBase.isSelected

### sendKeys

- sendKeys(...varArgs): Promise<void>

- #### Parameters

  - ##### `Rest` ...varArgs: (string | number | Promise<string | number>)[]

  #### Returns Promise<void>

  #### Inherit Doc

  Inherited from OjFilePickerBase.sendKeys

### `Protected` setProperty

- setProperty<T>(propertyName, value): Promise<void>

- Set a property value on the remote element. This function first waits for the BusyContext to clear before setting the property, then after setting, waits again to ensure that no additional busy states were created due to the property setting.

  #### Type Parameters

  - #### T = string

  #### Parameters

  - ##### propertyName: string

    The property name to set

  - ##### value: T

    The value to set for the property

  #### Returns Promise<void>

  A Promise which resolves when the remote property has been set to the value. Any value returned from the call to set the remote property is returned in the Promise.

  Inherited from OjFilePickerBase.setProperty

### submit

- submit(): Promise<void>

- #### Returns Promise<void>

  #### Inherit Doc

  Inherited from OjFilePickerBase.submit

### takeScreenshot

- takeScreenshot(optScroll?): Promise<string>

- #### Parameters

  - ##### `Optional` optScroll: boolean

  #### Returns Promise<string>

  #### Inherit Doc

  Inherited from OjFilePickerBase.takeScreenshot

### whenBusyContextReady

- whenBusyContextReady(): Promise<void>

- Returns a Promise that is resolved when the application's busy state reports ready. This method checks only that the application's busy context is ready, and not that the DOM element is actually displayed or has a physical size, such as is the case with #whenReady. Operations which are read-only in nature should call this method prior to execution.

  #### Returns Promise<void>

  A Promise which is resolved when the page's busy state is ready.

  Inherited from OjFilePickerBase.whenBusyContextReady

### whenReady

- whenReady(): Promise<void>

- Returns a Promise that is resolved when the element is ready for interaction--it is visible, has a size, and the app's busy context is ready. Operations on the DOM which rely on its physical location and size to be in a "ready" state should use this command, such as clicking, sending keys, locating child elements, and so on.

  #### Returns Promise<void>

  A Promise that's resolved when all conditions are met.

  Inherited from OjFilePickerBase.whenReady

### `Static` setupPickFiles

- setupPickFiles(driver, files): Promise<void>

- This method should be called right before ojfilepickerutils.pickFiles Takes the webdriver and an Array of objects containing file paths + types. These files will be read from the local filesystem and then sent to the pickFiles method to simulate user file selection. Only the basename of the file will be sent, not the entire path to make it consistent with how the browser sets the value.

  #### Parameters

  - ##### driver: WebDriver

    the Webdriver of the test

  - ##### files: {
    path: string;
    type: string;
    }[]

    An array of objects containing the path and type of selected files

  #### Returns Promise<void>

Generated using TypeDoc