Skip to content

Commit

Permalink
Merge pull request #97 from zploskey/pup1.9
Browse files Browse the repository at this point in the history
Add support for changes in Puppeteer 1.9
  • Loading branch information
zploskey authored Oct 14, 2018
2 parents 97315c2 + 12ad378 commit e6acf56
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 15 deletions.
2 changes: 2 additions & 0 deletions src/Browser.re
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ external createIncognitoBrowserContext: t => Js.Promise.t(BrowserContext.t) =
[@bs.send] [@bs.return nullable]
external process: t => option(Node.Process.t) = "";

[@bs.send] external target: t => Target.t = "";

[@bs.send] external targets: t => array(Target.t) = "";

[@bs.send] external userAgent: t => Js.Promise.t(string) = "";
Expand Down
15 changes: 15 additions & 0 deletions src/FrameBase.re
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ external makeTagOptions:
tagOptions =
"";

[@bs.send]
external goto:
(t, string, ~options: Navigation.options=?, unit) =>
Js.Promise.t(Js.null(Response.t)) =
"";

[@bs.send]
external selectOne:
(t, ~selector: string) => Js.Promise.t(Js.Null.t(ElementHandle.t('a))) =
Expand Down Expand Up @@ -54,6 +60,15 @@ external makeSelectorOptions:

/* TODO: waitForFunction */

[@bs.send]
external waitForNavigation:
(t, ~options: Navigation.options) => Js.Promise.t(Js.nullable(Response.t)) =
"";

let waitForNavigation = (page, ~options) =>
waitForNavigation(page, ~options)
|> Js.Promise.(then_(response => response |> Js.toOption |> resolve));

[@bs.send]
external waitForSelector:
(t, string, ~options: selectorOptions=?, unit) => Js.Promise.t(unit) =
Expand Down
15 changes: 0 additions & 15 deletions src/Page.re
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,6 @@ external goForward:
Js.Promise.t(Js.null(Response.t)) =
"";

[@bs.send]
external goto:
(t, string, ~options: Navigation.options=?, unit) =>
Js.Promise.t(Js.null(Response.t)) =
"";

[@bs.send] external isClosed: t => bool = "";

/** The page's virtual keyboard. */
Expand Down Expand Up @@ -343,15 +337,6 @@ external setViewport: (t, ~viewport: viewport) => Js.Promise.t(unit) = "";

[@bs.get] external tracing: t => Tracing.t = "";

[@bs.send]
external waitForNavigation:
(t, ~options: Navigation.options) => Js.Promise.t(Js.nullable(Response.t)) =
"";

let waitForNavigation = (page, ~options) =>
waitForNavigation(page, ~options)
|> Js.Promise.(then_(response => response |> Js.toOption |> resolve));

module WaitForRequest = {
[@bs.deriving abstract]
type options = {
Expand Down
7 changes: 7 additions & 0 deletions src/Response.re
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ type t = Types.response;
[@bs.send]
external buffer: t => Js.Promise.t(Node.Buffer.t) = "";

/**
* The frame that initiated the response. Will be null if navigating to
* error pages.
*/
[@bs.send]
external frame: t => Js.Null.t(Types.frame) = "";

/** If the response was served from the disk cache or memory cache. */
[@bs.send]
external fromCache: t => bool = "";
Expand Down
2 changes: 2 additions & 0 deletions src/Types.re
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ type request;

type response;

type frame;

type frameBase;

type target;

0 comments on commit e6acf56

Please sign in to comment.