Skip to content

Instantly share code, notes, and snippets.

@redbar0n
Created March 6, 2015 08:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save redbar0n/abb2524c9a883b11b44a to your computer and use it in GitHub Desktop.
Save redbar0n/abb2524c9a883b11b44a to your computer and use it in GitHub Desktop.
capybara-webkit fails after trying to find an element around 70 times..
it "the state 'Completed' should be tracked correctly", :js => true do
visit show_video_path(:unit_id => @unit.id, :channel_id => Channel.first.id, :w => 600, :h => 450)
puts "--- trying to click video ---"
#page.find("div.vjs-big-play-button").click #click play video button
find(:xpath,'//div[contains(@class,"vjs-big-play-button")]').click #click play video button -- alternative find method
# some more code, not being reached during execution...
puts "---"
end
› bundle exec rspec spec/features/tracking_spec.rb
No DRb server is running. Running in local process instead ...
Tracking
Finished "EnableLogging" with response "Success()"
Wrote response true ""
Received "Visit"
Started "Visit"
Load started
"Visit" started page load
Started request to "http://127.0.0.1:59288/video/show/1/1?h=450&w=600"
Finished "Visit" with response "Success()"
Started request to "http://127.0.0.1:59288/assets/venderviral/unit.css"
Started request to "http://127.0.0.1:59288/assets/venderviral/unit.js"
Received 200 from "http://127.0.0.1:59288/video/show/1/1?h=450&w=600"
Received 200 from "http://127.0.0.1:59288/assets/venderviral/unit.js"
Received 200 from "http://127.0.0.1:59288/assets/venderviral/unit.css"
Started request to "http://127.0.0.1:59288/assets/icons/share_white.png"
Started request to "http://127.0.0.1:59288/assets/icons/embed_close_white.png"
Started request to "http://127.0.0.1:59288/assets/icons/facebook_white.png"
Started request to "http://127.0.0.1:59288/assets/icons/twitter_t_white.png"
Started request to "http://127.0.0.1:59288/assets/icons/envelope_white.png"
Received 200 from "http://127.0.0.1:59288/assets/icons/facebook_white.png"
Received 200 from "http://127.0.0.1:59288/assets/icons/twitter_t_white.png"
Received 200 from "http://127.0.0.1:59288/assets/icons/envelope_white.png"
Received 200 from "http://127.0.0.1:59288/assets/icons/share_white.png"
Received 200 from "http://127.0.0.1:59288/assets/icons/embed_close_white.png"
Page finished with true
Load finished
Page load from command finished
Wrote response true ""
http://127.0.0.1:59288/assets/venderviral/unit.js|1413|VIDEOJS:
--- trying to click video ---
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(1)"
Wrote response true "1"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(2)"
Wrote response true "2"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(3)"
Wrote response true "3"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(4)"
Wrote response true "4"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(5)"
Wrote response true "5"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(6)"
Wrote response true "6"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(7)"
Wrote response true "7"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(8)"
Wrote response true "8"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(9)"
Wrote response true "9"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(10)"
Wrote response true "10"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(11)"
Wrote response true "11"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(12)"
Wrote response true "12"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(13)"
Wrote response true "13"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(14)"
Wrote response true "14"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(15)"
Wrote response true "15"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(16)"
Wrote response true "16"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(17)"
Wrote response true "17"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(18)"
Wrote response true "18"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(19)"
Wrote response true "19"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(20)"
Wrote response true "20"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(21)"
Wrote response true "21"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(22)"
Wrote response true "22"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(23)"
Wrote response true "23"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(24)"
Wrote response true "24"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(25)"
Wrote response true "25"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(26)"
Wrote response true "26"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(27)"
Wrote response true "27"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(28)"
Wrote response true "28"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(29)"
Wrote response true "29"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(30)"
Wrote response true "30"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(31)"
Wrote response true "31"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(32)"
Wrote response true "32"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(33)"
Wrote response true "33"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(34)"
Wrote response true "34"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(35)"
Wrote response true "35"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(36)"
Wrote response true "36"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(37)"
Wrote response true "37"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(38)"
Wrote response true "38"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(39)"
Wrote response true "39"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(40)"
Wrote response true "40"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(41)"
Wrote response true "41"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(42)"
Wrote response true "42"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(43)"
Wrote response true "43"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(44)"
Wrote response true "44"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(45)"
Wrote response true "45"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(46)"
Wrote response true "46"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(47)"
Wrote response true "47"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(48)"
Wrote response true "48"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(49)"
Wrote response true "49"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(50)"
Wrote response true "50"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(51)"
Wrote response true "51"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(52)"
Wrote response true "52"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(53)"
Wrote response true "53"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(54)"
Wrote response true "54"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(55)"
Wrote response true "55"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(56)"
Wrote response true "56"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(57)"
Wrote response true "57"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(58)"
Wrote response true "58"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(59)"
Wrote response true "59"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(60)"
Wrote response true "60"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(61)"
Wrote response true "61"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(62)"
Wrote response true "62"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(63)"
Wrote response true "63"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(64)"
Wrote response true "64"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(65)"
Wrote response true "65"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(66)"
Wrote response true "66"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(67)"
Wrote response true "67"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(68)"
Wrote response true "68"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(69)"
Wrote response true "69"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(70)"
Wrote response true "70"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(71)"
Wrote response true "71"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success(72)"
Wrote response true "72"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "Reset"
Started "Reset"
Finished "Reset" with response "Success()"
Wrote response true ""
the state 'Completed' should be tracked correctly (FAILED - 1)
Failures:
1) Tracking the state 'Completed' should be tracked correctly
Failure/Error: find(:xpath,'//div[contains(@class,"vjs-big-play-button")]').click
Capybara::ElementNotFound:
Unable to find xpath "//div[contains(@class,\"vjs-big-play-button\")]"
# ./spec/features/tracking_spec.rb:54:in `block (2 levels) in <top (required)>'
# If I comment out that line, and use `page.find("div.vjs-big-play-button").click #click play video button` instead,
# it gives this error instead:
# ...
Received "FindCss"
Started "FindCss"
Finished "FindCss" with response "Success(71)"
Wrote response true "71"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "FindCss"
Started "FindCss"
Finished "FindCss" with response "Success(72)"
Wrote response true "72"
Received "Node.visible"
Started "Node.visible"
Finished "Node.visible" with response "Success(false)"
Wrote response true "false"
Received "Reset"
Started "Reset"
Finished "Reset" with response "Success()"
Wrote response true ""
the state 'Completed' should be tracked correctly (FAILED - 1)
Failures:
1) Tracking the state 'Completed' should be tracked correctly
Failure/Error: page.find("div.vjs-big-play-button") #click play video button
Capybara::ElementNotFound:
Unable to find css "div.vjs-big-play-button"
# ./spec/features/tracking_spec.rb:54:in `block (2 levels) in <top (required)>'
# Strangely, it seems to try to execute the find about 70 times (in each case) before finally exiting with a fail condition. Don't know why it's around 70 times. Nothing in the code seems to specify it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment