问题
So I'm trying to test that the jQueryUI sortable library triggers an ajax request and I haven't been successful at triggering it, I've tried this with the jquery.simulate.drag-sortable.js library, but to no avail. I've also tried it with the execute script function, also to no avail. I am trying to manually trigger the sortable deactivate event because jQuery.trigger()
doesn't seem to work with it even in the browser. The script that is executed is $sortable.sortable("option", "deactivate")(event, ui)
with event and ui properly injected, this code works when I enter it directly into the browser.
The problem seems to stem from not being able to access the DOM. When I enable the debug mode on the driver the error is TypeError: '[object Object]' is not a function (evaluating '$sortable.sortable("option", "deactivate")(event, ui)')
. Digging a little deeper reveals that the Javascript driver can't access DOM nodes within #execute_javascript
. When I enter console.log(document.getElementById('sortable'));
The response is 'null'
.
Any thoughts on how to trigger the jQueryUI sortable function with the deactivate event using capybara-webkit?
来源:https://stackoverflow.com/questions/33618611/access-dom-from-capybara-webkit-execute-script