GoQuery browser automation

Hi
I’ve been experimenting and using the awesome GoQuery package ( https://godoc.org/github.com/PuerkitoBio/goquery ) for scraping web pages. It’s really wonderful for that. However I would very much like to use Go for some browser automation work too.

Question:
I can very easily, in GoQuery retrieve a web page and select, for example a button. I can extract the text from the button and so on, thats simple. How could I, from within Go, then execute the Click() event on that button. This is possible of course in jQuery : https://api.jquery.com/click/

I can see no easy way to execute that click event. Any thoughts or advice greatly appreciated. I am aware of the Selenium implementation for Go but was hoping that there would be a lighterweight possibility based on GoQuery.

Thanks!

1 Like

What do you want to achieve overall?

Hi @andreiii

Thanks for your interest. The goal would be to drive browser journeys to test web applications by logging in, navigating around, making selections from standard UI elements and ultimately hitting back end components.

I know there are other ways to do this (such as selenium) but driving or extending the GoQuery package feels like it would result in a light, fast solution if only there were options for interacting with the pages once selected and validated. Eg sending clicks, setting values in controls and so on.

Thanks

From what I see GoQuery is a parsing thing on top of HTML. While you can query the contents of the loaded HTML, it does not run Javascript or do other things a browser does.

I found this package some time ago, initially we used it to test our app deployments, but lately we have been using for integration/acceptance testing. check it out you might like it

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.