Selenium WebDriver错误:没有这样的帧错误

时间:2017-08-31 21:12:23

标签: ruby-on-rails ruby selenium-webdriver

我正在尝试运行:https://github.com/jmopr/job-hunter

我是通过命令rails server执行的。收集了一些申请职位的帖子,然后当我点击“申请工作”时弹出一个窗口但是没有提交给Indeed.com的信息被粘贴在表格中。然后窗口关闭,然后进入下一个工作档案。它似乎不能选择合适的框架,我不确定究竟是什么导致了这一点。

主要错误:

[remote server] file:///tmp/webdriver-profile20170831-19043-haskqi/extensions/fxdriver@googlecode.com/components/driver-component.js:10840:in `FirefoxDriver.prototype.switchToFrame': Unable to locate frame: 1 (Selenium::WebDriver::Error::NoSuchFrameError)

因为我怀疑这里的主要罪魁祸首是兼容性问题,所以这里列出的软件和特定的宝石可能会过时或以不相容的方式更新:

  

Firefox:45。Ubuntu 16.04。 Geckodriver 1.18.0(无关???)   硒:0.2.11。 Selenium webdriver:2.53.0。

我尝试使用不同版本的firefox,webdriver,看看我是否有任何兼容性问题,没有成功。以下是错误的其余部分:

Started GET "/users/apply" for 127.0.0.1 at 2017-08-31 14:08:21 -0700
Processing by JobsController#apply as HTML
User Load (0.1ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1  [["id", 1]]
Job Load (0.3ms)  SELECT "jobs".* FROM "jobs" WHERE (score > 40)
Running via Spring preloader in process 19571
applier.rb:121: warning: key "How did you hear about this job?" is duplicated and overwritten on line 127
^C[2017-08-31 14:08:31] INFO  going to shutdown ...
/var/lib/gems/2.3.0/gems/childprocess-0.5.9/lib/childprocess/abstract_process.rb:148:in `sleep': Interrupt
from /var/lib/gems/2.3.0/gems/childprocess-0.5.9/lib/childprocess/abstract_process.rb:148:in `poll_for_exit'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/binary.rb:59:in `quit'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/launcher.rb:62:in `quit'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/bridge.rb:77:in `quit'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/common/driver.rb:175:in `quit'
from /var/lib/gems/2.3.0/gems/capybara-2.7.0/lib/capybara/selenium/driver.rb:248:in `quit'
from /var/lib/gems/2.3.0/gems/capybara-2.7.0/lib/capybara/selenium/driver.rb:20:in `block in browser'
from /var/lib/gems/2.3.0/gems/spring-1.7.1/lib/spring/application.rb:161:in `fork'
from /var/lib/gems/2.3.0/gems/spring-1.7.1/lib/spring/application.rb:161:in `serve'
from /var/lib/gems/2.3.0/gems/spring-1.7.1/lib/spring/application.rb:131:in `block in run'
from /var/lib/gems/2.3.0/gems/spring-1.7.1/lib/spring/application.rb:125:in `loop'
from /var/lib/gems/2.3.0/gems/spring-1.7.1/lib/spring/application.rb:125:in `run'
from /var/lib/gems/2.3.0/gems/spring-1.7.1/lib/spring/application/boot.rb:19:in `<top (required)>'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
[remote server] file:///tmp/webdriver-profile20170831-19571-ugrrq/extensions/fxdriver@googlecode.com/components/driver-component.js:10840:in `FirefoxDriver.prototype.switchToFrame': Unable to locate frame: 1 (Selenium::WebDriver::Error::NoSuchFrameError)
from [remote server] file:///tmp/webdriver-profile20170831-19571-ugrrq/extensions/fxdriver@googlecode.com/components/command-processor.js:12661:in `DelayedCommand.prototype.executeInternal_/h'
from [remote server] file:///tmp/webdriver-profile20170831-19571-ugrrq/extensions/fxdriver@googlecode.com/components/command-processor.js:12666:in `DelayedCommand.prototype.executeInternal_'
from [remote server] file:///tmp/webdriver-profile20170831-19571-ugrrq/extensions/fxdriver@googlecode.com/components/command-processor.js:12608:in `DelayedCommand.prototype.execute/<'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/remote/response.rb:70:in `assert_ok'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/remote/response.rb:34:in `initialize'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/remote/http/common.rb:78:in `new'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/remote/http/common.rb:78:in `create_response'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/remote/http/default.rb:90:in `request'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/remote/http/common.rb:59:in `call'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/remote/bridge.rb:649:in `raw_execute'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/remote/bridge.rb:627:in `execute'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/remote/bridge.rb:206:in `switchToFrame'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/common/target_locator.rb:37:in `frame'
from /var/lib/gems/2.3.0/gems/capybara-2.7.0/lib/capybara/selenium/driver.rb:151:in `within_frame'
from applier.rb:29:in `scrape'
from applier.rb:169:in `<top (required)>'
from /var/lib/gems/2.3.0/gems/railties-4.2.5.1/lib/rails/commands/runner.rb:60:in `load'
from /var/lib/gems/2.3.0/gems/railties-4.2.5.1/lib/rails/commands/runner.rb:60:in `<top (required)>'
from /var/lib/gems/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `require'
from /var/lib/gems/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `block in require'
from /var/lib/gems/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:240:in `load_dependency'
from /var/lib/gems/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `require'
from /var/lib/gems/2.3.0/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:123:in `require_command!'
from /var/lib/gems/2.3.0/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:90:in `runner'
from /var/lib/gems/2.3.0/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /var/lib/gems/2.3.0/gems/railties-4.2.5.1/lib/rails/commands.rb:17:in `<top (required)>'
from /var/lib/gems/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `require'
from /var/lib/gems/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `block in require'
from /var/lib/gems/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:240:in `load_dependency'
from /var/lib/gems/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `require'
from /home/mo/Desktop/job-hunter-master/bin/rails:9:in `<top (required)>'
from /var/lib/gems/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `load'
from /var/lib/gems/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `block in load'
from /var/lib/gems/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:240:in `load_dependency'
from /var/lib/gems/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `load'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'

可悲的是我以前做过这项工作。它让我疯狂,不能复制它。丢失的包可能导致这个吗?当你第一次安装硒宝石时,我们是否需要安装jar文件(但我不使用windows !!)?

代码(applier.rb):

def scrape
unless @job.applied
  visit @job.url
  unless page.has_css?('p.expired')
    page.find('a.indeed-apply-button', match: :first).click

    page.driver.within_frame(1) do
      page.driver.within_frame(0) do
        complete_step_one
        complete_additional_steps
      end
    end
  end
  Job.delete(@job.id)
  page.close
end

0 个答案:

没有答案