如何从节点或Python WebDriver运行HTML Selenium测试?

问题描述 投票:0回答:1

我正在尝试使用ghost inspector chrome扩展来创建测试,但由于网站不在线并且使用https,因此ngrok不想正常工作,因此无法运行它们。我找到了将测试导出为Selenium格式的选项,它给我这样的HTML:

<meta name="ghost-inspector-screenshotCompareThreshold" content="0.1" />
 </head>
 <body>
 <table cellpadding="1" cellspacing="1" border="1">
 <thead>
 <tr>
 <td rowspan="1" colspan="3">Registration</td>
 </tr>
 </thead>
 <tbody>
 <tr>
 <td>open</td>
 <td>/</td>
 <td></td>
 </tr>
<tr>
 <td>waitForPageToLoad</td>
 <td></td>
 <td></td>
 </tr>
<tr>
 <td>waitForElementPresent</td>
 <td>css=a[href="#/registration"]</td>
 <td></td>
 </tr>
<tr>
 <td>click</td>
 <td>css=a[href="#/registration"]</td>
 <td></td>
 </tr>

如何从该文件运行测试?我需要安装和执行什么?

python selenium
1个回答
2
投票

Ghost Inspector创始人在这里。那些Selenium HTML导出设计用于Selenium IDESelenium Builder,两者都是免费的Firefox扩展。它们允许您在自己的浏览器中本地运行测试。

如果您有兴趣将这些测试转换为代码,我建议使用上面的Selenium Builder。它有一些很好的选项可以导入提供的HTML,然后使用各种不同的框架输出WebDriver代码。

根据您的测试的复杂程度,您可能需要在导入上述扩展之一后进行一些调整,但绝大多数命令都应该开箱即用。

希望对您有所帮助!

© www.soinside.com 2019 - 2024. All rights reserved.