Sending a KEY to a Page with Selenium IDE -


i need simulate pressing f5 trigger refresh of site. idea using sendkeysandwait ${key_12}, understand it, need element target command.

with webdriver solved problem this:

actions action = new actions(_driver); action.sendkeys(keys.f12).perform(); 

is there way send f12 or other key page?

i tried sending event body, doesn't work.

i tried sending event first input find (this works dont want it, there sites without input elements in out appplication)

my last hope javascript file. created function , added selenium core extensions :

selenium.prototype.dohotkey = function(target,value) { var keyboardevent = document.createevent("keyboardevent"); var initmethod = typeof keyboardevent.initkeyboardevent !== 'undefined' ? "initkeyboardevent" : "initkeyevent"; keyboardevent[initmethod](                "keypress", // event type : keydown, keyup, keypress                 true, // bubbles                 true, // cancelable                 window, // viewarg: should window                 false, // ctrlkeyarg                 false, // altkeyarg                 false, // shiftkeyarg                 false, // metakeyarg                 value, // keycodearg : unsigned long virtual key code, else 0                 0 // charcodeargs : unsigned long unicode character associated depressed key, else 0 ); // window.dispatchevent(keyboardevent); // nothing  // document.dispatchevent(keyboardevent); // nothing body.dispatchevent(keyboardevent); // undefined } 

but here found, window not page @ all. tips?

i had js file , selenium core extension (save code in js file , add extensions under options/general) can call

command : hotkey target : value : 13 // enter 

js:

selenium.prototype.dohotkey = function(target,value) {  var win = this.browserbot.getcurrentwindow(); // way site var doc = win.document; var keyboardevent = doc.createevent("keyboardevent"); var initmethod = typeof keyboardevent.initkeyboardevent !== 'undefined' ? "initkeyboardevent" : "initkeyevent";   keyboardevent[initmethod](                "keydown", // event type : keydown, keyup, keypress                 true, // bubbles                 true, // cancelable                 win, // viewarg: should window                 false, // ctrlkeyarg                 false, // altkeyarg                 false, // shiftkeyarg                 false, // metakeyarg                 value, // keycodearg : unsigned long virtual key code, else 0                 0 // charcodeargs : unsigned long unicode character associated depressed key, else 0  );  doc.body.dispatchevent(keyboardevent);  } 

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -