fix: page.authenticate
This commit is contained in:
parent
9977c83259
commit
b40bcdb92d
@ -21,6 +21,9 @@ export const _newPage = b => () => b.newPage()
|
|||||||
/** @type {(_: Browser | BrowserContext) => () => Promise<Array<Page>>} */
|
/** @type {(_: Browser | BrowserContext) => () => Promise<Array<Page>>} */
|
||||||
export const _all = b => () => b.pages()
|
export const _all = b => () => b.pages()
|
||||||
|
|
||||||
|
/** @type {(_: {username: string, password: string}) => (_: Page) => () => Promise<void>} */
|
||||||
|
export const _authenticate = creds => p => () => p.authenticate(creds)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {(_1: string) => (_2: Page) => () => Promise<Array<ElementHandle<any>>>}
|
* @type {(_1: string) => (_2: Page) => () => Promise<Array<ElementHandle<any>>>}
|
||||||
*/
|
*/
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
module Puppeteer.Page
|
module Puppeteer.Page
|
||||||
( module X
|
( module X
|
||||||
|
, authenticate
|
||||||
, new
|
, new
|
||||||
, all
|
, all
|
||||||
, findAll
|
, findAll
|
||||||
@ -102,6 +103,7 @@ foreign import mouse :: Page -> Effect Unit
|
|||||||
foreign import touchscreen :: Page -> Effect Unit
|
foreign import touchscreen :: Page -> Effect Unit
|
||||||
foreign import isClosed :: Page -> Effect Boolean
|
foreign import isClosed :: Page -> Effect Boolean
|
||||||
|
|
||||||
|
foreign import _authenticate :: { username :: String, password :: String } -> Page -> Effect (Promise Unit)
|
||||||
foreign import _newPage :: Foreign -> Effect (Promise Page)
|
foreign import _newPage :: Foreign -> Effect (Promise Page)
|
||||||
foreign import _all :: Foreign -> Effect (Promise (Array Page))
|
foreign import _all :: Foreign -> Effect (Promise (Array Page))
|
||||||
foreign import _findAll :: forall a. String -> Page -> Effect (Promise (Array (Handle a)))
|
foreign import _findAll :: forall a. String -> Page -> Effect (Promise (Array (Handle a)))
|
||||||
@ -118,6 +120,9 @@ foreign import _viewport :: Page -> Foreign
|
|||||||
new :: forall b. PageProducer b => b -> Aff Page
|
new :: forall b. PageProducer b => b -> Aff Page
|
||||||
new = Promise.toAffE <<< _newPage <<< unsafeToForeign
|
new = Promise.toAffE <<< _newPage <<< unsafeToForeign
|
||||||
|
|
||||||
|
authenticate :: { username :: String, password :: String } -> Page -> Aff Unit
|
||||||
|
authenticate creds = Promise.toAffE <<< _authenticate creds
|
||||||
|
|
||||||
all :: forall b. PageProducer b => b -> Aff (Array Page)
|
all :: forall b. PageProducer b => b -> Aff (Array Page)
|
||||||
all = Promise.toAffE <<< _all <<< unsafeToForeign
|
all = Promise.toAffE <<< _all <<< unsafeToForeign
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user