IEDocumentText

open System
open System.Windows.Forms 

let webDocumentCompleted (sender: obj) (e: WebBrowserDocumentCompletedEventArgs) =
    let web = sender :?> (WebBrowser) 
    Console.Write(web.DocumentText)

[<STAThread>]
[<EntryPoint>]
let main argv= 
    let url =
        match argv.Length with
        | 0 -> Console.ReadLine()
        | _ -> argv.[0]
    let web = new WebBrowser()
    web.Navigate(url)
    web.DocumentCompleted.Add(webDocumentCompleted web)
    while web.ReadyState <> WebBrowserReadyState.Complete do               
        Application.DoEvents()
    Console.Read() |> ignore
    0

 

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注