Class: Playwright::Video
- Inherits:
-
Object
- Object
- Playwright::Video
- Defined in:
- lib/playwright/video.rb
Instance Method Summary collapse
- #delete ⇒ Object
-
#initialize(page, artifact: nil) ⇒ Video
constructor
A new instance of Video.
- #path ⇒ Object
- #save_as(path) ⇒ Object
Constructor Details
#initialize(page, artifact: nil) ⇒ Video
Returns a new instance of Video.
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/playwright/video.rb', line 3 def initialize(page, artifact: nil) @page = page @artifact = Concurrent::Promises.resolvable_future if artifact @artifact.fulfill(artifact) elsif @page.closed? on_page_closed else page.once('close', -> { on_page_closed }) end end |
Instance Method Details
#delete ⇒ Object
41 42 43 44 45 |
# File 'lib/playwright/video.rb', line 41 def delete wait_for_artifact_and do |artifact| artifact.delete end end |
#path ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/playwright/video.rb', line 26 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
35 36 37 38 39 |
# File 'lib/playwright/video.rb', line 35 def save_as(path) wait_for_artifact_and do |artifact| artifact.save_as(path) end end |