https://github.com/dlenroc/appium-html-driver
WebDriver for testing HTML applications
https://github.com/dlenroc/appium-html-driver
appium html webdriver
Last synced: 8 months ago
JSON representation
WebDriver for testing HTML applications
- Host: GitHub
- URL: https://github.com/dlenroc/appium-html-driver
- Owner: dlenroc
- License: mit
- Created: 2021-12-12T19:40:53.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-03-24T22:25:37.000Z (about 1 year ago)
- Last Synced: 2025-03-24T23:26:03.419Z (about 1 year ago)
- Topics: appium, html, webdriver
- Language: TypeScript
- Homepage:
- Size: 668 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Appium HTML Driver · [](https://www.npmjs.com/package/@dlenroc/appium-html-driver)    
Appium HTML Driver is a WebDriver that allows controlling applications written using web technologies, regardless of the device they are running on.
## Installation
```sh
appium driver install --source npm @dlenroc/appium-html-driver
```
## Usage
1. Instrumentation
Inject the following code in every HTML file that belongs to your application.
```html
```
Where:
- origin - address of the Appium server, for example: `http://192.168.0.2:4723`.
- udid _(optional)_ - identifier that represent your device, default to client's IP address.
- handle _(optional)_ - identifier that will represent the window handle.
2. Attach and run test
```typescript
await driver = await remote({
'capabilities': {
'platformName': 'html',
'appium:automationName': 'html',
'appium:udid': udid
},
});
/**
* Load instrumented page manually, via cli or in any other way
*
* NOTE: that is not driver's responsibility
*/
// Attach to target
const handles = await driver.getWindowHandles();
await driver.switchToWindow(handles[0]);
// Conduct testing
await driver.getUrl()
.should.eventually.be.fulfilled;
```
## Capabilities
| Capability | Required | Type | Description |
| ----------------------- | :------: | :----: | ------------------------------------------------------ |
| `platformName` | + | string | Must be `html` |
| `appium:automationName` | + | string | Must be `html` |
| `appium:udid` | + | string | See [Connection](#connection) |
| `appium:handle` | - | string | The window handle to switch to during session creation |
## Commands
| Command | Description |
| ----------------------------------------------------------------- | -------------------------- |
| [active](src/client/commands/active.ts) | Get active element |
| [back](src/client/commands/back.ts) | Back |
| [clear](src/client/commands/clear.ts) | Element clear |
| [click](src/client/commands/click.ts) | Element click |
| [closeWindow](src/server/commands/closeWindow.ts) | Close window |
| [createNewWindow](src/server/commands/createNewWindow.ts) | New window |
| [deleteCookie](src/client/commands/deleteCookie.ts) | Delete cookie |
| [deleteCookies](src/client/commands/deleteCookies.ts) | Delete all cookies |
| [elementDisplayed](src/client/commands/elementDisplayed.ts) | Is element displayed |
| [elementEnabled](src/client/commands/elementEnabled.ts) | Is element enabled |
| [elementSelected](src/client/commands/elementSelected.ts) | Is element selected |
| [execute](src/client/commands/execute.ts) | Execute script |
| [executeAsync](src/client/commands/executeAsync.ts) | Execute async script |
| [findElement](src/client/commands/findElOrEls.ts) | Find element |
| [findElementFromElement](src/client/commands/findElOrEls.ts) | Find element form element |
| [findElements](src/client/commands/findElOrEls.ts) | Find elements |
| [findElementsFromElement](src/client/commands/findElOrEls.ts) | Find elements from element |
| [forward](src/client/commands/forward.ts) | Forward |
| [getAttribute](src/client/commands/getAttribute.ts) | Get element attribute |
| [getCookie](src/client/commands/getCookie.ts) | Get named cookie |
| [getCookies](src/client/commands/getCookies.ts) | Get all cookies |
| [getCssProperty](src/client/commands/getCssProperty.ts) | Get element CSS value |
| [getElementRect](src/client/commands/getElementRect.ts) | Get element rect |
| [getName](src/client/commands/getName.ts) | Get element tag name |
| [getPageSource](src/client/commands/getPageSource.ts) | Get page source |
| [getProperty](src/client/commands/getProperty.ts) | Get element property |
| [getText](src/client/commands/getText.ts) | Get element text |
| [getTimeouts](src/server/commands/getTimeouts.ts) | Get timeouts |
| [getUrl](src/client/commands/getUrl.ts) | Get current URL |
| [getWindowHandle](src/server/commands/getWindowHandle.ts) | Get window handle |
| [getWindowHandles](src/server/commands/getWindowHandles.ts) | Get window handles |
| [getWindowRect](src/client/commands/getWindowRect.ts) | Get window rect |
| [maximizeWindow](src/client/commands/maximizeWindow.ts) | Maximize window |
| [refresh](src/client/commands/refresh.ts) | Refresh |
| [setCookie](src/client/commands/setCookie.ts) | Add cookie |
| [setFrame](src/client/commands/setFrame.ts) | Switch to frame |
| [setUrl](src/client/commands/setUrl.ts) | Navigate to URL |
| [setValue](src/client/commands/setValue.ts) | Element send keys |
| [setWindow](src/server/commands/setWindow.ts) | Switch to window |
| [setWindowRect](src/client/commands/setWindowRect.ts) | Set window rect |
| [switchToParentFrame](src/client/commands/switchToParentFrame.ts) | Switch to parent frame |
| [timeouts](src/server/commands/timeouts.ts) | Set timeouts |
| [title](src/client/commands/title.ts) | Get title |