2018-10-09 05:28:15 +02:00
|
|
|
LET google = DOCUMENT("https://www.google.com/", true)
|
2018-09-28 01:05:56 +02:00
|
|
|
|
2018-10-09 05:28:15 +02:00
|
|
|
INPUT(google, 'input[name="q"]', "ferret", 25)
|
|
|
|
CLICK(google, 'input[name="btnK"]')
|
2018-09-28 01:05:56 +02:00
|
|
|
|
2018-10-09 05:28:15 +02:00
|
|
|
WAIT_NAVIGATION(google)
|
2018-09-28 01:05:56 +02:00
|
|
|
|
2018-10-09 05:28:15 +02:00
|
|
|
FOR result IN ELEMENTS(google, '.g')
|
|
|
|
// filter out extra elements like videos and 'People also ask'
|
|
|
|
FILTER TRIM(result.attributes.class) == 'g'
|
|
|
|
RETURN {
|
|
|
|
title: INNER_TEXT(result, 'h3'),
|
|
|
|
description: INNER_TEXT(result, '.st'),
|
|
|
|
url: INNER_TEXT(result, 'cite')
|
|
|
|
}
|