脱机时可以运行基于HTML的Selenium测试吗? [英] Can I run HTML based Selenium tests when I'm offline?

查看:92
本文介绍了脱机时可以运行基于HTML的Selenium测试吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Selenium的新手,并且正在使用Selenium IDE,所以最终得到的是这样的表结构:

I'm a newbie with Selenium and am using the Selenium IDE, so I'm ending up with table structures like this:

<table cellspacing="1" cellpadding="1" border="1" name="SELENIUM-TEST">
  <thead>
    <tr class="title">
      <td colspan="3">UI Basic Interaction</td>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>store</td>
      <td><urltool portal_url="" at=""></urltool></td>
      <td>base_url</td>
    </tr>
    ...
    <tr>
     <td>waitForPageToLoad</td>
     <td><br></td>
     <td></td>
    </tr>
    <tr>
     <td>waitForElementPresent</td>
     <td>//div[@id="global-panel"]</td>
     <td></td>
    </tr>
   </tbody>
 </table>

我需要离线运行此测试,这意味着我不应该模拟浏览器处于脱机状态,而是真正地拔出"电源,然后运行测试.

I'm required to run this test offline, that means I should not simulate the browser being offline, but really "unplug" and then run the tests.

问题:
我没有真正找到有关硒和脱机使用的大量信息,因此在使用

Question:
I'm not really finding a lot of information on Selenium and offline usage, so is this at all possible when using the Selenium IDE? Thanks for some pointers!

推荐答案

Selenium只不过与浏览器进行交互.它通过启动启动浏览器实例的驱动程序(remotewebdriver,chromedriver,firefoxdriver等)来实现.该实例允许WebDriver像用户一样钩住dom并对其进行控制.它不给您操作系统控制权,因此文件下载可能很困难.尽管有很多有关如何执行此操作的说明.假设您的页面是本地页面,并且所有链接也都在其中,那么您应该不会有任何问题.如果要使用远程Web驱动程序,则需要在该PC上设置网格.否则,只需使用本地驱动程序之一.

Selenium does nothing more than interact with the browser. It does this by starting a driver (remotewebdriver, chromedriver, firefoxdriver, etc) which kicks off a browser instance. That instance allows WebDriver to hook into the dom and control it like a user does. It does not give you OS control therefore file downloads can be difficult. There are plenty of instructions on how to do that though. Assuming your page is local and all links are as well, you shouldn't have any problem. If you want to use the remote web driver, you'll need to setup a grid on that pc. Otherwise, simply use one of the local drivers.

这篇关于脱机时可以运行基于HTML的Selenium测试吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆