mirror of
https://github.com/MontFerret/ferret.git
synced 2025-01-08 03:13:15 +02:00
f7f17ea5b4
* Added new network events * Refactored runtime Event streaming * Added support of using keywords as variables * Added support of body property in response event * Added example of subscription to network response * Added example of subscription to network requests * Fixed infinite loop bug * Updated Google example * Updated unit tests * Reenamed Event to Message * Fixed navvigation filtering by frame
23 lines
701 B
Plaintext
23 lines
701 B
Plaintext
LET google = DOCUMENT("https://www.google.com/", {
|
|
driver: "cdp",
|
|
userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36"
|
|
})
|
|
|
|
HOVER(google, 'input[name="q"]')
|
|
WAIT(RAND(100))
|
|
INPUT(google, 'input[name="q"]', @criteria, 30)
|
|
WAIT(RAND(100))
|
|
CLICK(google, 'input[name="btnK"]')
|
|
|
|
WAITFOR EVENT "navigation" IN google
|
|
|
|
WAIT_ELEMENT(google, "#res")
|
|
|
|
LET results = ELEMENTS(google, X("//*[text() = 'Search Results']/following-sibling::*/*"))
|
|
|
|
FOR el IN results
|
|
RETURN {
|
|
title: INNER_TEXT(el, 'h3')?,
|
|
description: INNER_TEXT(el, X("//em/parent::*")),
|
|
url: ELEMENT(el, 'a')?.attributes.href
|
|
} |