Represents a Venom entity that exists within a window environment.

Methods

  • Simulates key a sequence of keyboard.

    Parameters

    Returns Promise<void>

    Example

    // Press the 'A' key.
    await venom.key(KeyCode.A)

    // Press the 'Ctrl' key and 'C' key to copy.
    await venom.key(KeyCode.Ctrl, KeyCode.C)
  • Simulates keyboard input of a specified string.

    Parameters

    • input: string

      The string to be typed as keyboard input.

    Returns Promise<void>

    Example

    // Type 'Hello World!' as keyboard input.
    await venom.keyInput('Hello World!')
  • Simulates pressing a keyboard key.

    Parameters

    Returns Promise<void>

    Example

    // Hold the 'A' key.
    await venom.keyPress(KeyCode.A)
  • Simulates releasing a keyboard key.

    Parameters

    Returns Promise<void>

    Example

    // Press the 'A' key before releasing it.
    await venom.keyPress(KeyCode.A)

    // Release the 'A' key.
    await venom.keyRelease(KeyCode.A)
  • Simulates a mouse click action.

    Returns Promise<void>

    Example

    // Press the left mouse button.
    await venom.mouseClick()

    // Press the right mouse button.
    await venom.mouseClick({ key: 'right' })

    // Press the left mouse button at the position (100, 100).
    await venom.mouseClick({ x: 100, y: 100 })

    // Press the left mouse button at the position (100, 100) in relative space.
    await venom.mouseClick({ x: 100, y: 100, space: 'relative' })
  • Parameters

    Returns Promise<void>

  • Parameters

    Returns Promise<void>

  • Moves the mouse to the specified position.

    Parameters

    Returns Promise<void>

    Example

    // Moves the mouse to the position (100, 100).
    await venom.mouseMoveTo({ x: 100, y: 100 })

    // Moves the mouse to the position (100, 100) in relative space.
    await venom.mouseMoveTo({ x: 100, y: 100, space: 'relative' })
  • Simulates a mouse press action.

    Returns Promise<void>

    Example

    // Press the left mouse button.
    await venom.mousePress()

    // Press the right mouse button.
    // await venom.mousePress({ key: 'right' })

    // Press the left mouse button at the position (100, 100).
    // await venom.mousePress({ x: 100, y: 100 })

    // Press the left mouse button at the position (100, 100) in relative space.
    // await venom.mousePress({ x: 100, y: 100, space: 'relative' })
  • Parameters

    Returns Promise<void>

  • Parameters

    Returns Promise<void>

  • Simulates a mouse release action.

    Returns Promise<void>

    Example

    // Press the left mouse button before releasing the mouse.
    await venom.mousePress()

    // Release the left mouse button.
    await venom.mouseRelease()

    // Release the right mouse button.
    // await venom.mouseRelease({ key: 'right' })

    // Release the left mouse button at the position (100, 100).
    // await venom.mouseRelease({ x: 100, y: 100 })

    // Release the left mouse button at the position (100, 100) in relative space.
    // await venom.mouseRelease({ x: 100, y: 100, space: 'relative' })
  • Parameters

    Returns Promise<void>

  • Parameters

    Returns Promise<void>

  • Simulates a mouse scroll down action.

    Returns Promise<void>

    Example

    // Scroll down the mouse wheel.
    await venom.mouseScrollDown()

    // Scroll down the mouse wheel by 3 ticks.
    await venom.mouseScrollDown({ tick: 3 })

    // Scroll down the mouse wheel by 3 ticks at the position (100, 100).
    await venom.mouseScrollDown({ tick: 3, x: 100, y: 100 })

    // Scroll down the mouse wheel by 3 ticks at the position (100, 100) in relative space.
    await venom.mouseScrollDown({ tick: 3, x: 100, y: 100, space: 'relative' })
  • Parameters

    Returns Promise<void>

  • Parameters

    Returns Promise<void>

  • Simulates a mouse scroll up action.

    Returns Promise<void>

    Example

    // Scroll up the mouse, default is one tick.
    await venom.mouseScrollUp()

    // Scroll up the mouse wheel by 3 ticks.
    await venom.mouseScrollUp({ tick: 3 })

    // Scroll up the mouse wheel by 3 ticks at the position (100, 100).
    await venom.mouseScrollUp({ tick: 3, x: 100, y: 100 })

    // Scroll up the mouse wheel by 3 ticks at the position (100, 100) in relative space.
    await venom.mouseScrollUp({ tick: 3, x: 100, y: 100, space: 'relative' })
  • Parameters

    Returns Promise<void>

  • Parameters

    Returns Promise<void>

  • Creates a Venom instance based on the provided URL, window context, and host descriptor.

    Parameters

    • url: string

      The URL from which the Venom is being created. (TODO: Remove this argument in future versions)

    • hwnd: number

    Returns Promise<Venom>

    A Promise resolving to a Venom instance.