2019-08-04 17:25:47 -04:00
|
|
|
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"
|
|
|
|
})
|
|
|
|
|
2020-06-17 17:37:01 -04:00
|
|
|
HOVER(google, 'input[name="q"]')
|
|
|
|
WAIT(RAND(100))
|
|
|
|
INPUT(google, 'input[name="q"]', @criteria, 30)
|
|
|
|
WAIT(RAND(100))
|
2019-08-04 17:25:47 -04:00
|
|
|
CLICK(google, 'input[name="btnK"]')
|
|
|
|
|
2021-09-02 11:09:48 -04:00
|
|
|
WAITFOR EVENT "navigation" IN google
|
|
|
|
|
|
|
|
WAIT_ELEMENT(google, "#res")
|
|
|
|
|
2021-11-22 14:36:28 -05:00
|
|
|
LET results = ELEMENTS(google, X("//*[text() = 'Search Results']/following-sibling::*/*"))
|
2019-08-04 17:25:47 -04:00
|
|
|
|
2021-11-22 14:36:28 -05:00
|
|
|
FOR el IN results
|
2019-08-04 17:25:47 -04:00
|
|
|
RETURN {
|
2021-11-22 14:36:28 -05:00
|
|
|
title: INNER_TEXT(el, 'h3')?,
|
|
|
|
description: INNER_TEXT(el, X("//em/parent::*")),
|
2021-09-02 11:09:48 -04:00
|
|
|
url: ELEMENT(el, 'a')?.attributes.href
|
2019-08-04 17:25:47 -04:00
|
|
|
}
|