문제

I am doing a robot test for some keypress event handler. Looks like firefox has some different key code , say for enter the key code in firefox is 10 instead of 13;

    Press Key  element  \\10

this would work, instead of Press Key element \\13 Right now, I am having a trouble finding a key code for right arrow press. I tried

    Press Key  element  \\39

but doesn't work, the firefox would open a search box rather than trigger a right arrow press when running this key word.

Besides, the left, up, down arrow key press (37, 38, 40) are all working correctly. Does any one know how to make a right arrow key press in selenium when testing in firefox?

도움이 되었습니까?

해결책

a workaround would be run "Execute Javascript" keyword in robot to dispatch a javascript event on the page.

Execute Javascript  var evt = document.createEvent("KeyboardEvent");evt.initKeyEvent("keydown", true, true, window, 0, 0, 0, 0,39, 0);document.getElementsByClassName('focus')[0].dispatchEvent(evt);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top