mirror of
https://github.com/MontFerret/ferret.git
synced 2025-01-10 03:16:58 +02:00
e6dd5689b4
* Fixed logger level * Fixed WAITFOR EVENT parser * Added tracing to Network Manager * Updated logging * Swtitched to value type of logger * Added tracing * Increased websocket maximum buffer size * Ignore unimportant error message * Added support of new CDP API for layouts * Switched to value type of logger * Added log level * Fixed early context cancellation * Updated example of 'click' action * Switched to val for elements lookup * Fixed unit tests * Refactored 'eval' module * Fixed SetStyle eval expression * Fixed style deletion * Updated logic of setting multiple styles
27 lines
907 B
Plaintext
27 lines
907 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")
|
|
|
|
FOR el IN ELEMENTS(google, '#kp-wp-tab-overview > [jsdata]')
|
|
// filter out extra elements like media and 'People also ask'
|
|
FILTER ELEMENT_EXISTS(el, "#media_result_group") == FALSE
|
|
FILTER ELEMENT_EXISTS(el, '[role="heading"]') == FALSE
|
|
|
|
LET descr = (FOR i IN ELEMENTS(el, "span") FILTER LENGTH(i.attributes) == 0 RETURN i)
|
|
|
|
RETURN {
|
|
title: INNER_TEXT(el, 'h3'),
|
|
description: FIRST(descr),
|
|
url: ELEMENT(el, 'a')?.attributes.href
|
|
} |