【发布时间】:2014-05-09 23:10:03
【问题描述】:
我正在尝试使用 F# 和 Canopy 编写一个简单的爬虫(请参阅 http://lefthandedgoat.github.io/canopy/)。我正在尝试从具有“.application-tile”类的所有元素中提取文本。但是,在下面的代码中,我收到以下构建错误,我不明白。
This expression was expected to have type
OpenQA.Selenium.IWebElement -> 'a
but here has type
OpenQA.Selenium.IWebElement
知道为什么会这样吗?谢谢!
open canopy
open runner
open System
[<EntryPoint>]
let main argv =
start firefox
"taking canopy for a spin" &&& fun _ ->
url "https://abc.com/"
// Login Page
"#i0116" << "abc@abc.com"
"#i0118" << "abc"
click "#abcButton"
// Get the Application Tiles -- BUILD ERROR HAPPENS HERE
elements ".application-tile" |> List.map (fun tile -> (tile |> (element ".application-name breakWordWrap"))) |> ignore
run()
【问题讨论】:
-
你想用你的 List.map 完成什么?
-
我正在尝试从每个元素中获取文本/内容。
标签: f# canopy-web-testing