Class: Playwright::Video

Inherits:
Object
  • Object
show all
Defined in:
lib/playwright/video.rb

Instance Method Summary collapse

Constructor Details

#initialize(page) ⇒ Video

Returns a new instance of Video.



3
4
5
6
7
8
9
10
11
# File 'lib/playwright/video.rb', line 3

def initialize(page)
  @page = page
  @artifact = Concurrent::Promises.resolvable_future
  if @page.closed?
    on_page_closed
  else
    page.once('close', -> { on_page_closed })
  end
end

Instance Method Details

#deleteObject



39
40
41
42
43
# File 'lib/playwright/video.rb', line 39

def delete
  wait_for_artifact_and do |artifact|
    artifact.delete
  end
end

#pathObject



24
25
26
27
28
29
30
31
# File 'lib/playwright/video.rb', line 24

def path
  if @page.send(:remote_connection?)
    raise 'Path is not available when using browserType.connect(). Use save_as() to save a local copy.'
  end
  wait_for_artifact_and do |artifact|
    artifact.absolute_path
  end
end

#save_as(path) ⇒ Object



33
34
35
36
37
# File 'lib/playwright/video.rb', line 33

def save_as(path)
  wait_for_artifact_and do |artifact|
    artifact.save_as(path)
  end
end