@@ -1,38 +1,48 @@
1module Playwright
1module Playwright
4 , isConnected
5 , isConnected
10 , queryMany
20 , queryMany
11 , screenshot
21 , screenshot
12 , textContent
22 , textContent
13 , module Playwright.Data
24 , module Playwright.Data
14 , module Playwright.Options
25 , module Playwright.Options
19import Effect (Effect)
29import Effect (Effect)
20−-- import Control.Promise (toAffE)
21import Effect.Aff (Aff)
30import Effect.Aff (Aff)
22−import Untagged.Coercible (class Coercible, coerce)
31+import Literals.Null (Null)
23−import Untagged.Union (type (|+|), UndefinedOr)
24import Node.Buffer (Buffer)
32import Node.Buffer (Buffer)
25import Playwright.Data
33import Playwright.Data
26−import Playwright.Options
27import Playwright.Internal (effCall, effProp, affCall)
34import Playwright.Internal (effCall, effProp, affCall)
28−import Literals.Null (Null)
35+import Playwright.Options
37+import Untagged.Coercible (class Coercible)
38+import Untagged.Union (type (|+|), UndefinedOr)
31 :: forall o
41 :: forall o
32 . Coercible o LaunchOptions
42 . Coercible o LaunchOptions
33 => BrowserType -> o -> Aff Browser
43 => BrowserType -> o -> Aff Browser
34launch bt opts =
44launch bt opts =
35− affCall "launch" typeInfo bt (coerce opts :: LaunchOptions)
45+ affCall "launch" typeInfo bt opts
37 typeInfo _ = launch
47 typeInfo _ = launch
@@ -62,14 +72,14 @@ newPage
62 => x -> o -> Aff Page
72 => x -> o -> Aff Page
63newPage sth opts =
73newPage sth opts =
64 affCall "newPage" typeInfo sth opts
74 affCall "newPage" typeInfo sth opts
65− where typeInfo _ = newPage :: x -> o -> Aff Page
75+ where typeInfo _ = newPage
68 :: forall o
78 :: forall o
69 . Coercible o GoOptions
79 . Coercible o GoOptions
70 => Page -> o -> Aff (Null |+| Response)
80 => Page -> o -> Aff (Null |+| Response)
71goForward page opts =
81goForward page opts =
72− affCall "goForward" typeInfo page (coerce opts :: GoOptions)
82+ affCall "goForward" typeInfo page opts
73 where typeInfo _ = goForward
83 where typeInfo _ = goForward
@@ -77,7 +87,7 @@ goBack
77 . Coercible o GoOptions
87 . Coercible o GoOptions
78 => Page -> o -> Aff (Null |+| Response)
88 => Page -> o -> Aff (Null |+| Response)
79goBack page opts =
89goBack page opts =
80− affCall "goBack" typeInfo page (coerce opts :: GoOptions)
90+ affCall "goBack" typeInfo page opts
81 where typeInfo _ = goBack
91 where typeInfo _ = goBack
@@ -86,7 +96,7 @@ goto
86 => Coercible o GotoOptions
96 => Coercible o GotoOptions
87 => x -> URL -> o -> Aff (Null |+| Response)
97 => x -> URL -> o -> Aff (Null |+| Response)
88goto x url' opts =
98goto x url' opts =
89− affCall "goto" typeInfo x url' (coerce opts :: GotoOptions)
99+ affCall "goto" typeInfo x url' opts
90 where typeInfo _ = goto
100 where typeInfo _ = goto
92type Cookie =
102type Cookie =
@@ -101,8 +111,7 @@ addCookies
101 -> Aff Unit
111 -> Aff Unit
102addCookies bc cookies =
112addCookies bc cookies =
103 affCall "addCookies" typeInfo bc cookies
113 affCall "addCookies" typeInfo bc cookies
105− typeInfo _ = addCookies
114+ where typeInfo _ = addCookies
108 :: forall x o
117 :: forall x o
@@ -118,8 +127,8 @@ innerHTML
118 . Coercible x (Page |+| Frame |+| ElementHandle)
127 . Coercible x (Page |+| Frame |+| ElementHandle)
119 => Coercible o InnerHTMLOptions
128 => Coercible o InnerHTMLOptions
120 => x -> Selector -> o -> Aff String
129 => x -> Selector -> o -> Aff String
121−innerHTML x selector o =
130+innerHTML x selector opts =
122− affCall "innerHTML" typeInfo x selector (coerce o :: InnerHTMLOptions)
131+ affCall "innerHTML" typeInfo x selector opts
123 where typeInfo _ = innerHTML
132 where typeInfo _ = innerHTML
@@ -130,10 +139,9 @@ innerText
130 -> Selector
139 -> Selector
132 -> Aff String
141 -> Aff String
133−innerText x sel o =
142+innerText x sel opts =
134− affCall "innerText" typeInfo x sel o
143+ affCall "innerText" typeInfo x sel opts
135− where typeInfo _ = innerText
144+ where typeInfo _ = innerText :: x -> Selector -> o -> Aff String
136− :: x -> Selector -> o -> Aff String
138isClosed :: Page -> Effect Boolean
146isClosed :: Page -> Effect Boolean
139isClosed = effCall "isClosed" \_ -> isClosed
147isClosed = effCall "isClosed" \_ -> isClosed
@@ -141,6 +149,12 @@ isClosed = effCall "isClosed" \_ -> isClosed
141keyboard :: Page -> Effect Keyboard
149keyboard :: Page -> Effect Keyboard
142keyboard = effProp "keyboard"
150keyboard = effProp "keyboard"
152+mainFrame :: Page -> Effect Frame
153+mainFrame = effCall "mainFrame" \_ -> mainFrame
155+name :: Frame -> Effect String
156+name = effCall "name" \_ -> name
144-- | `sth.$(selector)`
158-- | `sth.$(selector)`
146 :: forall x
160 :: forall x
@@ -180,6 +194,6 @@ url
180 :: forall x
194 :: forall x
181 . Coercible x (Page |+| Frame |+| Download |+| Request |+| Response |+| Worker)
195 . Coercible x (Page |+| Frame |+| Download |+| Request |+| Response |+| Worker)
183− -> Effect String
197+ -> Effect URL
184−url = effCall "url" typeInfo
198+url x = effCall "url" typeInfo x
185− where typeInfo _ = url :: x -> Effect String
199+ where typeInfo _ = url