ページにExtJsのテキストフィールドがあります。私はcasper.jsで値を入力していますが、うまくいきます。
次に、このフィールドにフォーカスを合わせてと入力してください。<form>
がありません。私が試した何casper.js:ExtJsの入力フィールドに「enter」キーを押します
されました:
casper.then(function() {
// the text field is filled with the string
this.sendKeys('#searchfield', 'some text');
this.evaluate(function() {
// this does not put the field in focus
document.querySelector('#searchfield').focus();
// so 'pressing' enter has no effect at all
var evt = document.createEvent('KeyboardEvent');
evt.initKeyboardEvent('keypress', true, true, window, 0, 0, 0, 0, 0, 13);
document.dispatchEvent(evt);
});
});
あなたはどのようにこれを達成するために任意のアイデアを持っていますか?
かのおかげで結果を確認してください。問題はcasperレベルではなく、通常のブラウザウィンドウ(Chrome)でさえもないことがわかりました。 –