Steve Eggering
Steve Eggering

Reputation: 798

How to have PhantomJSCloud wait for imbedded javascript in content

I am passing an HTML string to PhantomJSCloud in the "content" of the page. The HTML has JS embedded in it inside script tags at the end of the string. When I return the jpeg that I am requesting from PJSC, the objects that the JS manipulates, have not been manipulated. I know the js works, because I can copy and paste the whole html string to a file, open it in chrome, and watch it happen.

It is using Chart.js, which has an animation option, but i have set it to false.

Currently my request JSON looks like this:

  "pages": [
    {
      "content": "$$$CONTENT$$$",
      "renderSettings": {
        "quality": 100,
        "selector": "[id='report']"
      },
      "requestSettings": {
        "ioWait": 5000,
        "waitInterval": 5000
      }
    }
  ]
}

Replacing the "$$$CONTENT$$$" with my actual HTML string. The whole request takes less than 5 seconds so the "waitInterval" doesn't seem to be what I'm looking for.

Upvotes: 1

Views: 331

Answers (1)

Steve Eggering
Steve Eggering

Reputation: 798

This turned out to not be an issue of whether it was waiting on the javascript. My javascript was manipulating text, and some of that text had a \n inside of it. It apparently needed a \\\n

Upvotes: 1

Related Questions