2.0.1 • Published 4 months ago

@dlenroc/roku-dom v2.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

@dlenroc/roku-dom · NPM Version

DOM-like representation of the app-ui

Installation

npm install @dlenroc/roku-dom

Usage

⚠️ render() must be called for synchronizing DOM with application state

import { Document } from '@dlenroc/roku-dom';
import { ECPExecutor } from '@dlenroc/roku-ecp';
import { ODCExecutor } from '@dlenroc/roku-odc';

const document = new Document({
  ecp: new ECPExecutor({ address: 'http://<ip>:8060' }),
  odc: new ODCExecutor({ address: 'http://<ip>:8061' }),
});

// Sync DOM
await document.render();
const element = document.cssSelect('[text="Play"]');
console.log(element?.isFocused);

Document

Everything from Element

get context(): 'ECP' | 'ODC'
set context(context: 'ECP' | 'ODC')
get fields(): Record<string, string[]>
set fields(fields: Record<string, string[]>)
get focusedElement(): Element
get isKeyboardShown(): boolean
render(): Promise<void>

Element

get sdk(): SDK
get document(): Document
get parent(): Element | null
get parents(): Element[]
get siblings(): Element[]
get prev(): Element | null
get next(): Element | null
get children(): Element[]
get tag(): string
get path(): string
get index(): number
get attributes(): Record<string, string>
get text(): string
get bounds(): Rect | null
get isConnected(): boolean
get isFocused(): boolean
get isInFocusChain(): boolean
get isDisplayed(): boolean
isSameNode(element: Element): boolean
clear(): Promise<void>
type(text: string): Promise<void>
append(text: string): Promise<void>
select(): Promise<void>
focus(): Promise<void>
cssSelect(css: string): Element | null
cssSelect(css: string, timeoutInSeconds: number): Promise<Element | null>
cssSelectAll(css: string): Element[]
cssSelectAll(css: string, timeoutInSeconds: number): Promise<Element[]>
xpathSelect(xpath: string): Element | null
xpathSelect(xpath: string, timeoutInSeconds: number): Promise<Element | null>
xpathSelectAll(xpath: string): Element[]
xpathSelectAll(xpath: string, timeoutInSeconds: number): Promise<Element[]>
toString(): string
2.0.1

4 months ago

2.0.0

5 months ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago