我可以在离线状态下运行基于HTML的Selenium测试吗? [英] Can I run HTML based Selenium tests when I'm offline?

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

问题描述



 <$ c我是一名新手,并且使用Selenium IDE,因此我最终得到了如下表结构: $ c>< table cellspacing =1cellpadding =1border =1name =SELENIUM-TEST> 
< thead>
< tr class =title>
< td colspan =3> UI基本互动< / td>
< / tr>
< / thead>
< tbody>
< tr>
< td>商店< / 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并没有真正找到关于Selenium和离线使用的大量信息,所以当使用 Selenium IDE ?感谢您的一些指示!

解决方案

Selenium只不过是与浏览器交互。它通过启动驱动程序(remotewebdriver,chromedriver,firefoxdriver等)来启动浏览器实例。该实例允许WebDriver挂接到dom并像用户那样控制它。它不会给你操作系统控制,因此文件下载可能很困难。有很多关于如何做到这一点的说明。假设你的页面是本地的,并且所有的链接都是一样的,你不应该有任何问题。如果您想使用远程网络驱动程序,则需要在该PC上设置网格。否则,只需使用本地驱动程序之一。




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 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天全站免登陆