lib/culerity/remote_browser_proxy.rb in caius-culerity-0.1.7 vs lib/culerity/remote_browser_proxy.rb in caius-culerity-0.1.8
- old
+ new
@@ -40,9 +40,22 @@
end
end
true
end
+
+ #
+ # Specify whether to accept or reject all confirm js dialogs
+ # for the code in the block that's run.
+ #
+ def confirm(bool, &block)
+ blk = "lambda { #{bool} }"
+
+ self.send_remote(:add_listener, :confirm) { blk }
+ block.call
+ self.send_remote(:remove_listener, :confirm) { blk }
+ end
+
private
def remote_object_id
(@remote_object_id || 'browser').inspect
end
\ No newline at end of file