I've found myself in a corner more than once, trying to use the built in search traversal with JS methods.
One example of that would be interacting with <select> augmenting JS scripts (selectable, select2 etc.). In order to work around issues with those, I need to be able to invoke pieces of JS on some elements.
For example:
// [...] find the field to change
$field->selectOption($option, false);
$this->getSession()->evaluateScript('$("select").trigger("change");');
Currently there's no easy method to get reference to the NodeElement node in JS. Internally, Selenium2 driver uses executeJsOnXpath() method which takes a script template and "injects" the element we want to target. I'd love to be able to do this:
// [...] find the field to change
$field->selectOption($option, false);
$field->executeJs('$({{ELEMENT}}).trigger("change");');
I've found myself in a corner more than once, trying to use the built in search traversal with JS methods.
One example of that would be interacting with
<select>augmenting JS scripts (selectable, select2 etc.). In order to work around issues with those, I need to be able to invoke pieces of JS on some elements.For example:
Currently there's no easy method to get reference to the
NodeElementnode in JS. Internally, Selenium2 driver usesexecuteJsOnXpath()method which takes a script template and "injects" the element we want to target. I'd love to be able to do this: