JavaScript中的onClick事件在Golang中如何实现?

huangapple go评论91阅读模式
英文:

JavaScript onClick event in golang

问题

尝试使用golang自动化一些Web/浏览器任务时,我在点击、触摸和滑动交互方面遇到了障碍。

感谢令人惊叹的https://github.com/PuerkitoBio/goquery库,我能够解析网页并与表单进行交互。

自动化页面的一个重要部分是模拟触发JavaScript的鼠标点击。

在golang中如何实现这一点?我需要模拟操作系统级别的鼠标点击,还是浏览器有一个可以使用的API?

英文:

In an attempt to automate some web/browser tasks with golang I reached a barrier when if comes comes to click, touch and swipe interaction.

Thanks to the amazing https://github.com/PuerkitoBio/goquery library I am able to parse webpages and I am able to interact with form sheets.

One integral part that is missing to automate pates is simulating mouse clicks that trigger javascript.

How would it be possible to implement this in golang? Do I need to simulate OS level mouse clicks or do browsers have an API that I can use?

答案1

得分: 0

你需要使用类似Selenium的工具,它有至少一个Go语言客户端

英文:

You would need to use something like Selenium's WebDriver which has at least one go client

huangapple
  • 本文由 发表于 2016年12月9日 04:07:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/41047950.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定