如何从node或python webdriver运行htmlselenium测试?

2024-04-27 23:30:55 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试使用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>

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


Tags: httpsinspector网站格式选项seleniumregistrationchrome
1条回答
网友
1楼 · 发布于 2024-04-27 23:30:55

Ghost Inspector创始人在这里。这些Selenium HTML导出被设计为使用Selenium IDE和{a3},这两个都是免费的Firefox扩展。它们允许您在自己的浏览器中本地运行测试。在

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

根据测试的复杂程度,一旦导入到上面的某个扩展中,您可能需要做一些调整,但绝大多数命令都应该是开箱即用的。在

希望对你有帮助!在

相关问题 更多 >