Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Driver doesn't like ajax clicks #19

Closed
jc00ke opened this issue Apr 16, 2011 · 3 comments
Closed

Driver doesn't like ajax clicks #19

jc00ke opened this issue Apr 16, 2011 · 3 comments

Comments

@jc00ke
Copy link
Contributor

jc00ke commented Apr 16, 2011

I have a spec that passes when I use akephalos but fails using capybara-webkit.
Here's the gist of the scenario:

On the dashboard (logged in), if you delete a widget (link_to :method => delete, :remote => true...) then the event listener in coffeescript kinda like

$('.widgets a[data-method="delete"]').ajaxSuccess (event, xhr, settings) ->
# do some stuff
.ajaxError ->
  alert "Borked"

should capture the successful deletion. However, capybara-webkit fails and I get an alert message "Borked". Manually testing this scenario confirms it works, as does running it with Akephalos. Sorry if this is a bit vague, but I can't easily extract an example from my client's app. Please let me know what info I can provide to help out. I'd love to switch to capybara-webkit. Saves ~ 30 seconds on each run over Akephalos!

@thijsc
Copy link

thijsc commented Apr 17, 2011

This happens because webkit actually opens an alert. Since capybara-webkit has direct access I think it should be possible to write something that can click ok in accepts.

In our current Selenium projects we use a helper like this:

def accept_alert(page)
  page.execute_script('window.alert = function() { return true; }')
end

You need to call this before the alert occurs.

@jc00ke
Copy link
Contributor Author

jc00ke commented Apr 18, 2011

I tried executing that same function before and it didn't work, but I will give it another go. I looked around for an example that would click OK but I couldn't find anything.

@jc00ke
Copy link
Contributor Author

jc00ke commented Apr 18, 2011

Ok, nothing is wrong. How about we just forget this ever happened? ;-)

@jc00ke jc00ke closed this as completed Apr 18, 2011
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants