Database |> Language |> Keywords |> 

CLICK

Note: For a high level of where this keyword fits into, check out our browser docs.

One of the fundamental interactions for the web is clicking on things. The CLICK keyword allows you to define a click interaction as a qualifier for the page state you’re interested in querying from. The below query shows how to grab posts from Hacker News:

FROM https://news.ycombinator.com
|> GROUP BY span.titleline
|> SELECT a AS post

However if I were interested in plucking the posts from Hacker News that start with the Ask HN: prefix, I could work from the URL directly.

FROM https://news.ycombinator.com/ask
|> GROUP BY span.titleline
|> SELECT a AS post

Alternatively, if I were approaching this as a page where it’s imminent I start from a particular URL prior to page altering operations before plucking data, I could CLICK on the link in the top navbar using an attribute selector.

FROM https://news.ycombinator.com/ask
|> CLICK ON a[href="ask"] -- CLICK'ing before SELECT'ing
|> GROUP BY span.titleline
|> SELECT a AS post

It of course follows variables could be used to enhance the readability:

hn <| https://news.ycombinator.com |
ask_link <| a[href="ask"] |
container <| span.titleline |
post <| a |

FROM https://news.ycombinator.com/ask
|> CLICK ON ask_link -- CLICK'ing before SELECT'ing
|> GROUP BY container
|> SELECT post