I'm trying to automate downloading the backup file created by Teamwork. The way it works is you login, go to a page which loads a dynamically generated iframe with a src="https://tw-backup.teamwork.com/ext.cfm?backupaction=downloadLatestMySQLBackup".
I've tried getting the actual link from from the iframe, but I haven't gotten that to work. However, the truncated link I'm using seems to work if I enter it in the browser. So I'm just trying to open it directly.
Unfortunately, it just seems to hang.
EDIT
phantomjs --version = 1.9.8;
Getting this error:
[debug] [phantom] url changed to "https://tw-backup.teamwork.com/ext.cfm?backupa
ction=downloadLatestMySQLBackup"
[debug] [phantom] Successfully injected Casper client-side utilities
[info] [phantom] Done 8 steps in 3427ms
finished
Unsafe JavaScript attempt to access frame with URL about:blank from frame with U
RL file:///c:/Users/Brad/AppData/Roaming/npm/node_modules/casperjs/bin/bootstrap
.js. Domains, protocols and ports must match.
So is the problem that I'm trying to access a different sub-domain than from where I start?
You can get a free trial of Teamwork if you're interested in this problem. And BTW, we're making good use it for project management.
var casper = require('casper').create();
casper.start('https://myco.teamwork.com/', function () {
console.log("start");
this.waitForSelector("input[name='userLogin']",
function success() {
this.sendKeys("input[name='userLogin']", "me@myco.org");
},
function fail() {
test.assertExists("input[name='userLogin']");
});
this.waitForSelector("input[name='password']",
function success() {
this.sendKeys("input[name='password']", "somePassword");
console.log("login successful");
},
function fail() {
test.assertExists("input[name='password']");
console.log("login failed");
});
this.thenOpen('https://tw-backup.teamwork.com/ext.cfm?backupaction=downloadLatestMySQLBackup');
});