代码之家  ›  专栏  ›  技术社区  ›  barlop Sandeep

使用ruby程序中的capybara和poltergeist访问https站点时出现“JQMIGRATE”错误

  •  0
  • barlop Sandeep  · 技术社区  · 7 年前

    我有一个计划

    大约一年半前,当我上次运行它时,它运行得很好,但现在运行它时,我遇到了一个错误。

    节目是-

     require 'capybara/poltergeist'
     session = Capybara::Session.new(:poltergeist)
    
    
    print "visiting http://www.wikipedia.com \r\n"                                                                                                    
    
    
    session.visit('http://www.wikipedia.com')
    
    print "no error visiting http://www.wikipedia.com \r\n"                                                                                                    
    
    print "visiting https://en.wikipedia.org/wiki/FIFA_World_Cup \r\n"                                                                                                    
    
    session.visit('https://en.wikipedia.org/wiki/FIFA_World_Cup')
    
    print "blah"  # prints blah so gets that far even though error from previous line.                                                                                                    
    

    @PATH=%PATH%;c:\gecko;c:\Program Files (x86)\Mozilla Firefox;c:\phantomjs\bin

    这条路一直很好,现在仍然很好。第一个session.visit行(指向http而非https的行)可以工作

    C:\rubytest\wikipediathing\current>ruby wikipediatest2.rb
    visiting http://www.wikipedia.com
    no error visiting http://www.wikipedia.com
    visiting https://en.wikipedia.org/wiki/FIFA_World_Cup
    JQMIGRATE: Migrate is installed with logging active, version 3.0.1
    This page is using the deprecated ResourceLoader module "schema.UniversalLanguageSelector".
    See https://phabricator.wikimedia.org/T205744 for migration info.
    blah
    C:\rubytest\wikipediathing\current>
    

    我去了 https://phabricator.wikimedia.org/T205744 但它只是讨论了事件日志记录,所以我看不到该链接的适用性或任何解决方案。

    1 回复  |  直到 7 年前
        1
  •  2
  •   Thomas Walpole    7 年前

    从技术上讲,您没有看到错误,您看到的是页面上使用的一些库的JS控制台日志输出。从您所展示的内容来看,它们是错误还是警告尚不清楚,但很可能维基百科已经将页面上使用的库升级到不再支持Poltergeist使用的PhantomJS版本的版本。这可能是因为PhantomJS开发因不再开发QtWebKit而停止/放弃。这使得Poltegeist/PhantomJS基本上相当于6-7年前的Safari版本,它已经超越了任何网站所有者/开发者真正关心支持的时代。从长远来看,通过selenium驱动程序而不是poltergeist驱动程序将程序升级为使用无头chrome会更好。

    推荐文章