简体   繁体   English

如何使用HTML中的按钮运行Selenium WebDriver

[英]How to run Selenium WebDriver using a button in HTML

How can I run Selenium Web Driver using a button in HTML? 如何使用HTML中的按钮运行Selenium Web Driver?

In most of the tutorials that I've read/watched regarding how to use Selenium Web Drivers, they code it and launch the browser and let the script manipulate things in the browser. 在我阅读/观看过的有关如何使用Selenium Web驱动程序的大多数教程中,它们都对其进行编码并启动浏览器,并让脚本在浏览器中进行操作。 But what if the browser is already open, and there's a button which when clicked, will run the script for the Selenium Web Driver? 但是,如果浏览器已经打开,并且有一个按钮,单击该按钮将运行Selenium Web Driver脚本怎么办?

How to do that? 怎么做?

To do this, you'll need to setup a CI/CD like Jenkins. 为此,您需要安装CI / CD,例如Jenkins。 Create a job in Jenkins which runs the automated Selenium tests. 在Jenkins中创建一个运行自动硒测试的作业。 Every job has an api to trigger it remotely. 每个作业都有一个api可以远程触发它。

Use this API in the HTML page you have in the button click to invoke the script. 在单击按钮的HTML页面中使用此API可以调用脚本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM