Problems with type() and END key

Asked by Daniel Kurtz

I'm doing the following in Eclipse:

     # Switch to application window.
     App.focus("Test App")

     scr = Screen()

     # Do some stuff with the scr object.

     # Scroll window to end.
      scr.type(Key.END)
      scr.click("close_button.png")

"scr.type(Key.END)" has the desired effect when executing in the IDE of scrolling to the end of the window. Under Eclipse with Jython it has no effect. No error or anything, just nothing happens.

Likewise with:

     scr.keyDown(Key.END)

Again, no error messages, just no result.

Have been trying to integrate a Selenium script that runs great under Python, and a Sikuli script that runs great in the IDE. And wow! it's been like wrestling cats. Neither seems to work as expected under Eclipse/PyDev/Jython.

ddk

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Daniel Kurtz
Solved:
Last query:
Last reply:
Revision history for this message
Eugene S (shragovich) said :
#1

What happens when you press the END button manually at the same time?
Does that have the desired effect?

Revision history for this message
Daniel Kurtz (dkurtz-p) said :
#2

To answer my own question, the problem is that focus is on a control on the page, and therefor the END press is acting only in the context of that control. IOW, it's going to the end of the text box, or the end of the list, not to the end of the page/window. I forgot that one of the things I did in moving the code into PyDev was to move that command from the FIRST thing I did on the window until just before I need to find the element that is (occasionally) scrolled out of view.

So, I went from:

App.focus()
type(Keys.End)
click('radiobutton1.png')
type('textbox1.png', 'Harry Potter')
click('savebutton.png')

Which worked, to:

App.focus()
click('radiobutton1.png')
type('textbox1.png', 'Harry Potter')
type(Keys.End)
click('savebutton.png')

Which didn't, because the focus was on 'textbox1' so I was just jumping to end of 'textbox1'.

For the moment I'm just maximizing the window, which makes sure the elements I need are in view about 9.5 times out of 10. To get those last .5, I'll do something else. I'm guessing I can just repeat App.focus(). Also I realize that I'm going to need <Control>-<End>, since <End> by itself just operates in 1 dimension on this app.

ddk