How do poltergeist/PhantomJS and capybara-webkit differ?

前端 未结 4 1064
故里飘歌
故里飘歌 2020-12-23 16:03
  1. What are the differences between PhantomJS and capybara-webkit?
  2. What are the advantages of capybara-webkit over PhantomJS?
  3. Which of the two is the mo
4条回答
  •  心在旅途
    2020-12-23 16:49

    poltergeist is the capybara driver for PhantomJS, a headless browser which is built on WebKit. capybara-webkit is a capybara driver which uses WebKit directly.

    poltergeist/PhantomJS has some big advantages over capybara-webkit:

    • In my experience poltergeist/PhantomJS always times out when it should, whereas capybara-webkit sometimes hangs.
    • Its error messages are much clearer. For example, it will actually tell you if it can't click an element that is on the page because there's another element in front of it.
    • It can be told to re-raise Javascript errors as test errors (by instantiating the driver with js_errors: true).
    • PhantomJS is much easier to install than standalone WebKit. PhantomJS provides a nearly dependency-free executable that you can download, while standalone WebKit has many OS library dependencies which you may have to upgrade or otherwise fiddle with.

提交回复
热议问题