fix: createCDPSession
This commit is contained in:
parent
500b6f1f7f
commit
bf075f9628
@ -1,4 +1,4 @@
|
|||||||
import { BrowserContext } from 'puppeteer'
|
import { BrowserContext, CDPSession } from 'puppeteer'
|
||||||
import { Keyboard } from 'puppeteer'
|
import { Keyboard } from 'puppeteer'
|
||||||
import { Mouse } from 'puppeteer'
|
import { Mouse } from 'puppeteer'
|
||||||
import { Touchscreen } from 'puppeteer'
|
import { Touchscreen } from 'puppeteer'
|
||||||
@ -18,6 +18,9 @@ export const touchscreen = p => () => p.touchscreen
|
|||||||
/** @type {(_: Browser | BrowserContext) => () => Promise<Page>} */
|
/** @type {(_: Browser | BrowserContext) => () => Promise<Page>} */
|
||||||
export const _newPage = b => () => b.newPage()
|
export const _newPage = b => () => b.newPage()
|
||||||
|
|
||||||
|
/** @type {(_: Page) => () => Promise<CDPSession>} */
|
||||||
|
export const _createCDPSession = p => () => p.createCDPSession()
|
||||||
|
|
||||||
/** @type {(_: Browser | BrowserContext) => () => Promise<Array<Page>>} */
|
/** @type {(_: Browser | BrowserContext) => () => Promise<Array<Page>>} */
|
||||||
export const _all = b => () => b.pages()
|
export const _all = b => () => b.pages()
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
module Puppeteer.Page
|
module Puppeteer.Page
|
||||||
( module X
|
( module X
|
||||||
|
, createCDPSession
|
||||||
, authenticate
|
, authenticate
|
||||||
, new
|
, new
|
||||||
, all
|
, all
|
||||||
@ -40,7 +41,7 @@ import Effect.Aff (Aff)
|
|||||||
import Foreign (Foreign, unsafeToForeign)
|
import Foreign (Foreign, unsafeToForeign)
|
||||||
import Node.Path (FilePath)
|
import Node.Path (FilePath)
|
||||||
import Puppeteer.Base (Page) as X
|
import Puppeteer.Base (Page) as X
|
||||||
import Puppeteer.Base (class PageProducer, Handle, Keyboard, LifecycleEvent, Page, URL, Viewport, duplexLifecycleEvent, duplexViewport, duplexWrite)
|
import Puppeteer.Base (class PageProducer, CDPSession, Handle, Keyboard, LifecycleEvent, Page, URL, Viewport, duplexLifecycleEvent, duplexViewport, duplexWrite)
|
||||||
import Puppeteer.Handle (unsafeCoerceHandle)
|
import Puppeteer.Handle (unsafeCoerceHandle)
|
||||||
import Puppeteer.Selector (class Selector, toCSS)
|
import Puppeteer.Selector (class Selector, toCSS)
|
||||||
import Simple.JSON (readImpl, undefined, writeImpl)
|
import Simple.JSON (readImpl, undefined, writeImpl)
|
||||||
@ -103,6 +104,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 _createCDPSession :: Page -> Effect (Promise CDPSession)
|
||||||
foreign import _authenticate :: { username :: String, password :: String } -> Page -> Effect (Promise Unit)
|
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))
|
||||||
@ -120,6 +122,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
|
||||||
|
|
||||||
|
createCDPSession :: Page -> Aff CDPSession
|
||||||
|
createCDPSession = Promise.toAffE <<< _createCDPSession
|
||||||
|
|
||||||
authenticate :: { username :: String, password :: String } -> Page -> Aff Unit
|
authenticate :: { username :: String, password :: String } -> Page -> Aff Unit
|
||||||
authenticate creds = Promise.toAffE <<< _authenticate creds
|
authenticate creds = Promise.toAffE <<< _authenticate creds
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user