Skip to content

Commit

Permalink
updated fritzbox port opener
Browse files Browse the repository at this point in the history
  • Loading branch information
joernroeder committed Aug 4, 2014
1 parent 6870f71 commit 6d97930
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions utils/topologyTestRunner/fritzBoxPortOpener.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,27 @@ function run () {

var checkPage = function () {
console.log('checking page...');
var form = window.frames['frame_content'].document.getElementsByTagName('form')[0];
var form = window.frames['frame_content'].contentDocument.getElementsByTagName('form')[0];

if (!form || !form.action) {
console.log('no form found');
runner();
}
else if (startPort === -1) {
startPort = parseInt(prompt('Port: 31000 + x', 0));
startPort = parseInt(prompt('Port: 33000 + x', 0));
processed = startPort;
runner();
}
else if (form.action.indexOf('/internet/port_fw_edit.lua') !== -1) {
console.log('edit form...');
if (isListPage) {
fillForm();
isListPage = false;
try {
fillForm();
isListPage = false;
}
catch(e) {
runner();
}
}
else {
console.log('edit form. already filled...');
Expand Down Expand Up @@ -54,7 +59,7 @@ function run () {
var fillForm = function () {
console.log('filling form');

var form = window.frames['frame_content'].document.getElementsByTagName('form')[0];
var form = window.frames['frame_content'].contentDocument.getElementsByTagName('form')[0];
var inputs = form.getElementsByTagName('input');
var port = startPort;

Expand All @@ -66,9 +71,17 @@ function run () {
inputs[4].value = 'Peeriod Test' + (port + 1);

// ports
inputs[5].value = 31000 + port;
inputs[6].value = 31000 + port;
inputs[8].value = 31000 + port;
inputs[5].value = 33000 + port;
inputs[6].value = 33000 + port;
inputs[8].value = 33000 + port;

// manual device
var devices = form.getElementsByTagName('select')[2];
devices.selectedIndex = devices.options.length - 1;
devices.onchange();

inputs[7].value = '192.168.178.175';


isListPage = true;
form.getElementsByTagName('button')[0].click();
Expand Down

0 comments on commit 6d97930

Please sign in to comment.