Skip to content

Instantly share code, notes, and snippets.

@TorstenRobitzki
Created November 21, 2012 16:29
Show Gist options
  • Select an option

  • Save TorstenRobitzki/4125852 to your computer and use it in GitHub Desktop.

Select an option

Save TorstenRobitzki/4125852 to your computer and use it in GitHub Desktop.
a minimum yasmine example
page = require('webpage').create();
page.viewportSize = { width: 1000, height: 700 };
phantom.viewportSize = { width: 1000, height: 700 };
page.open( "http://robitzki.de", function(status) {
try {
if ( status == "success" && page.injectJs( "jquery.min.js" ) )
{
result = page.evaluate( function() {
$('body').append('<div class="test_canvas"></div>')
var canvas = $('.test_canvas');
canvas.height( 240 );
canvas.width( 240 );
var new_div = $( '<div class="no-tile"></div>' );
new_div.offset( { top: 5, left: 6 } );
$('body').append( new_div );
return new_div.css('top');
} );
console.log( "result: " + result );
}
phantom.exit( 0 );
}
catch ( err )
{
console.log(err);
phantom.exit( 1 );
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment