Giter Club home page Giter Club logo

Comments (5)

sdesalas avatar sdesalas commented on July 19, 2024

Can you send me the whole script? I'll try debug it.

from triflejs.

mkliu avatar mkliu commented on July 19, 2024

Here you go. If I want to debug myself, how should I do it?

    var page = require('webpage').create(),
        system = require('system'),
        address, output, size;

    var output = "test.png";
    var address ="http://embed.plnkr.co/RxznuEsxVabaRVTGMbKa/preview";

    page.viewportSize = { width: 1800, height: 768 };
    page.open(address, function (status) {
        if (status !== 'success') {
            console.log('Unable to load the address!');
            phantom.exit();
        } else {
            window.setTimeout(function () {
                console.log(page.evaluate(function() {
                    var response;
                    var element = document.getElementById("test");    // script error, getBoundingClientRect not defined
                    //var element = document.querySelector('H1');         // returns {}
                    //var element = document.documentElement            // returns {}
                    var rect = element.getBoundingClientRect();
                    return rect;
                }));
                page.render(output);
                phantom.exit();
            }, 1000);
        }
    });

from triflejs.

sdesalas avatar sdesalas commented on July 19, 2024

Perfect thanks :). Will be back with some more info.

In the meantime try to open up the page http://embed.plnkr.co/RxznuEsxVabaRVTGMbKa/preview in IE Developer tools ยป Console and run the code in page.evaluate(function() { [[THIS CODE]] }) see what happens, in theory this should be no different to what happens in TrifleJS but if there is a difference I'll be able to tell you why.

One more thing. Which version of IE do you have installed?

from triflejs.

mkliu avatar mkliu commented on July 19, 2024

page is null, so i directly tried

      document.getElementById("test")

This returns null. I tried on both IE10 (Server 2012) and IE11(Win8). I also tried on Chrome, it returns null too. But the element definitely exist, I modified the plunk to test that.

from triflejs.

mkliu avatar mkliu commented on July 19, 2024

Actually, i figured out why, the element is inside an iframe. So close the issue.

from triflejs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.