Use a select outside of a form with CasperJS

天大地大妈咪最大 提交于 2019-12-01 11:36:54

Do you want to just simulate the normal behaviour? That's right in some issue manipulate the DOM isn't sufficient (the events are not thrown and so you can't send your form because the data isn't updated, and you have the errors of the ajax return). I've realized that when we're doing functional test, reproduce the user behaviour always works :) ->

this.mouse.down("selector of your select element");//press left button 
this.mouse.up('selector of the option of your select element');//release left button

Example :

this.mouse.down("div#ec1 select.jCustomSelect.monthB");//press left button 
this.mouse.up('div#ec1 select.jCustomSelect.monthB > option[value="7"]');//release left button

Or you could use jQuery and the change() method.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!