Class: Playwright::Mouse

Inherits:
PlaywrightApi show all
Defined in:
lib/playwright_api/mouse.rb

Overview

The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport.

Every ‘page` object has its own Mouse, accessible with [`property: Page.mouse`].

“‘js // Using ‘page.mouse’ to trace a 100x100 square. await page.mouse.move(0, 0); await page.mouse.down(); await page.mouse.move(0, 100); await page.mouse.move(100, 100); await page.mouse.move(100, 0); await page.mouse.move(0, 0); await page.mouse.up(); “`

“‘python async # using ‘page.mouse’ to trace a 100x100 square. await page.mouse.move(0, 0) await page.mouse.down() await page.mouse.move(0, 100) await page.mouse.move(100, 100) await page.mouse.move(100, 0) await page.mouse.move(0, 0) await page.mouse.up() “`

“‘python sync # using ‘page.mouse’ to trace a 100x100 square. page.mouse.move(0, 0) page.mouse.down() page.mouse.move(0, 100) page.mouse.move(100, 100) page.mouse.move(100, 0) page.mouse.move(0, 0) page.mouse.up() “`

Instance Method Summary collapse

Methods inherited from PlaywrightApi

#==, #initialize, wrap

Constructor Details

This class inherits a constructor from Playwright::PlaywrightApi

Instance Method Details

#click(x, y, button: nil, clickCount: nil, delay: nil) ⇒ Object

Shortcut for [‘method: Mouse.move`], [`method: Mouse.down`], [`method: Mouse.up`].

Raises:

  • (NotImplementedError)


42
43
44
45
46
47
48
49
# File 'lib/playwright_api/mouse.rb', line 42

def click(
      x,
      y,
      button: nil,
      clickCount: nil,
      delay: nil)
  raise NotImplementedError.new('click is not implemented yet.')
end

#dblclick(x, y, button: nil, delay: nil) ⇒ Object

Shortcut for [‘method: Mouse.move`], [`method: Mouse.down`], [`method: Mouse.up`], [`method: Mouse.down`] and [`method: Mouse.up`].

Raises:

  • (NotImplementedError)


53
54
55
# File 'lib/playwright_api/mouse.rb', line 53

def dblclick(x, y, button: nil, delay: nil)
  raise NotImplementedError.new('dblclick is not implemented yet.')
end

#down(button: nil, clickCount: nil) ⇒ Object

Dispatches a ‘mousedown` event.

Raises:

  • (NotImplementedError)


58
59
60
# File 'lib/playwright_api/mouse.rb', line 58

def down(button: nil, clickCount: nil)
  raise NotImplementedError.new('down is not implemented yet.')
end

#move(x, y, steps: nil) ⇒ Object

Dispatches a ‘mousemove` event.

Raises:

  • (NotImplementedError)


63
64
65
# File 'lib/playwright_api/mouse.rb', line 63

def move(x, y, steps: nil)
  raise NotImplementedError.new('move is not implemented yet.')
end

#up(button: nil, clickCount: nil) ⇒ Object

Dispatches a ‘mouseup` event.

Raises:

  • (NotImplementedError)


68
69
70
# File 'lib/playwright_api/mouse.rb', line 68

def up(button: nil, clickCount: nil)
  raise NotImplementedError.new('up is not implemented yet.')
end