Giter Club home page Giter Club logo

Comments (8)

jferris avatar jferris commented on September 24, 2024

I think the desired default behavior would be to raise an exception if a page loaded with a Javascript error, but I haven't figured out how to do that yet with Qt's WebKit.

from capybara-webkit.

gbarrancos avatar gbarrancos commented on September 24, 2024

That would be nice. Specially to trace issues in Javascript intensive web-apps, i.e: there is a javascript error that prevents my app from loading in capybara-webkit. Having that would help me to solve the compatibility problem.

@jferris Have you figured something out about this?

Thanks :D

from capybara-webkit.

seanami avatar seanami commented on September 24, 2024

I would love this as well. JS errors are logged in the test output, but I can't figure a way to get access to them within the page.

I have this in my output:

http://127.0.0.1:51777/test:171 ReferenceError: Can't find variable: adsfasdfdsafdsa

And ideally I'd like to be able to write something like this in my test:

page.javascript_errors.should be_empty

Possible?

from capybara-webkit.

jferris avatar jferris commented on September 24, 2024

I haven't found a way to explicitly get Javascript errors, but we could
return all the messages written to the console in a command. This would
include messages printed using console.log, but I don't think that would be
an issue.

If anybody wants to put together a pull request, it would involve saving
messages in WebPage::javaScriptConsoleMessage and a new command to return
them.

from capybara-webkit.

joefiorini avatar joefiorini commented on September 24, 2024

Just sent a pull request for this. I have it working in one of my own projects. Please let me know if there's anything I need to change. Thanks!

from capybara-webkit.

DaveSanders avatar DaveSanders commented on September 24, 2024

Is there anyway currently to get more information about the error? I occasionally get things like:

undefined:0 TypeError: 'null' is not an object

And I assume its undefined:0 because its coming back in an AJAX request, but I'm having a hard time tracking these types of errors down. Even having the line where the error occurred spit out would be great.

from capybara-webkit.

jferris avatar jferris commented on September 24, 2024

There isn't a way through the current API. There may be a way to get more information from QtWebkit. If you find one, feel free to submit a pull request.

from capybara-webkit.

halogenandtoast avatar halogenandtoast commented on September 24, 2024

Since this isn't a bug and it's something we've been striving for I'm going to close this. In the future we hope to have better JS error support.

from capybara-webkit.

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.