Parcourir la source

Fix #12 : Demostrate dialog handling

George S. Baugh il y a 5 ans
Parent
commit
5246433839
2 fichiers modifiés avec 18 ajouts et 0 suppressions
  1. 4 0
      MANIFEST.SKIP
  2. 14 0
      example.pl

+ 4 - 0
MANIFEST.SKIP

@@ -3,3 +3,7 @@ cover_db/*
 .travis.yml
 weaver.ini
 .git/*
+video/*
+test.jpg
+package-lock.json
+node_modules/*

+ 14 - 0
example.pl

@@ -84,4 +84,18 @@ $mouse->move( 0, 0 );
 my $keyboard = $page->keyboard();
 $keyboard->type('F12');
 
+# Start to do some more advanced actions with the page
+use FindBin;
+use Cwd qw{abs_path};
+my $pg = abs_path("$FindBin::Bin/at/test.html");
+
+# Handle dialogs on page start, and dialog after dialog
+$promise = $page->waitForEvent('dialog');
+$page->goto("file://$pg");
+
+my $dlg = $handle->await($promise);
+$promise = $page->waitForEvent('dialog');
+$dlg->dismiss();
+$dlg = $handle->await($promise);
+$dlg->accept();