0
假設我在Swift中的UIWebview中包含了Web應用程序。我怎樣才能檢索輸入欄,隱藏或鍵入類似下面如何使用Swift和Kanna庫獲取HTML表單值
<input type="text" name="code" value="Swift">
用斯威夫特和看那
這裏是我得到一個H2標籤工作正常碼的值。但我需要獲得輸入字段,特別是隱藏字段。
func parseHtml(html: String) {
if let doc = Kanna.HTML(html: html, encoding: String.Encoding.utf8) {
for node in doc.css("h2") {
let value = node.text!.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)
print("\(value)")
}
}
}