1

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!

3
  • Well what's the application under test? Where is it hosted? Commented Mar 6, 2014 at 16:37
  • The application is static files, plus a javascript "database" that will query either server or fallback to localstorage, if no connection. So everything is cacheable and should work "unhosted". Commented Mar 6, 2014 at 16:40
  • I'm more wondering about if I can use Selenium when having no access to a server? Commented Mar 6, 2014 at 16:41

2 Answers 2

0

You can unplug and take your machine offline by disabling the LAN connection before running the selenium tests, and then re-enabling it after.

On Windows 7/Vista and above, you can use the below commands wmic commands (requires cmd.exe is Run as Administrator).

First, get a list of all NICs on the machine, and their index:

 wmic nic get name, index

To Disable NIC, run the command:

 wmic path win32_networkadapter where index=7 call disable

To Enable NIC, run the command:

 wmic path win32_networkadapter where index=7 call enable

7 in the above examples is the index of the NIC adapter to disable, which can be found by looking at Network properties for the LAN connection.

I believe the index number does not change (unless you install/uninstall NICs), so you should be good enough obtaining the index once and then building .bat files for the enable disable commands.

These commands are not available on Windows XP, where you can use the devcon.exe tool (from Microsoft) instead (see it's command line help for usage).

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.