question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SyntaxError: JSON.parse at XMLHttpRequest

See original GitHub issue

Hi,

I’ve faced this issue with TestCafe 0.23.2, that is not present with TestCafe 0.22.0:


   1) Error on page "https://cloud-24-canary.eng.hortonworks.com/clusters":

      SyntaxError: JSON.parse
          at parse (http://10.200.51.193:1337/hammerhead.js:1:22280)
          at XMLHttpRequest.f (http://10.200.51.193:1337/hammerhead.js:9:24666)

      Browser: Chrome 70.0.3538 / Mac OS X 10.14.0

I get this issue after:

await t
        .expect(ClusterPage.getWidget(clusterName + '-os'))
        .eql(0, 'check cluster widget has been removed in 15 minutes', { timeout: 900000 });
    static getWidget(clusterName: string) {
        const isWidgetExists = Selector(PageHelper.elementWithDataQa(clusterName)).with({ visibilityCheck: true })
            .exists;

        if (isWidgetExists) {
            return Selector(PageHelper.elementWithAttribute('data-stack-name', clusterName)).with({
                visibilityCheck: true
            }).count;
        } else {
            return 0;
        }
    }

Google Chrome run options: {"path":"/Applications/Google Chrome.app","cmd":"--disable-infobars --disable-session-crashed-bubble --no-first-run --new-window --enable-automation --enable-logging --v=1 --no-sandbox --disable-background-networking --disable-software-rasterizer --user-data-dir=\"browser-data/google-chrome\" --disable-web-security --disable-extensions --disable-default-apps --disable-notifications --disable-sync --disable-translate --disable-save-password-bubble --disable-session-crashed-bubble --hide-scrollbars --metrics-recording-only --mute-audio --no-first-run --safebrowsing-disable-auto-update --password-store=basic --ignore-certificate-errors --allow-insecure-localhost","macOpenCmdTemplate":"open -n -a \"{{{path}}}\" --args {{{pageUrl}}} {{{cmd}}}"} TestCafe run options: {"speed":0.7,"selectorTimeout":80000,"assertionTimeout":120000,"pageLoadTimeout":60000,"skipUncaughtErrors":true}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
LavrovArtemcommented, Nov 22, 2018

I think I found the cause of this issue. I will try to fix it and will notify you once the fix is ready.

0reactions
lock[bot]commented, Mar 28, 2019

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SyntaxError: JSON.parse: bad parsing - JavaScript | MDN
JSON.parse() parses a string as JSON. This string has to be valid JSON and will throw this error if incorrect syntax was encountered....
Read more >
Why I cant JSON.parse a string from an API (Error msg: ...
Funny thing is if I do JSON.parse(xhr.response) and save it to a variable, it works perfectly fine. What am I doing wrong in...
Read more >
Uncaught SyntaxError: Unexpected end of JSON input
A common error encountered by JavaScript programmers is the Uncaught SyntaxError: Unexpected end of JSON input. This is usually observed when the coder...
Read more >
Example: JSON with Y.io
Pass the XHR responseText to Y.JSON.parse() and capture the return value. Note that the parse() method can throw a SyntaxError exception, so be...
Read more >
Unexpected token u in JSON at position 0 Error in JS [Fixed]
The "SyntaxError: Unexpected token u in JSON at position 0" error occurs when we pass a value that is not valid JSON to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found