711child / robotframework-swinglibrary

Automatically exported from code.google.com/p/robotframework-swinglibrary
Other
0 stars 0 forks source link

Create separate keywords for selecting from popup menus #195

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
In our test framework we need to be able to save a right click in a component 
separately from selecting a item from the popup menu. The current 
implementation of selectFromPopupMenu, and it related keywords, does both at 
once. We have done a workaround by using jemmy and swinglibrary APIs directly 
but it should be nice to have swinglibry supporting this feature. 

Original issue reported on code.google.com by daniel.g...@gmail.com on 19 Aug 2011 at 11:29

GoogleCodeExporter commented 9 years ago
If you have already implemented this, could you provide a patch? We have just 
started a small iteration developing SwingLibrary further and new keywords can 
easily be added. A patch with tests and docs would definitely be accepted but 
just seeing the code would help a lot.

Btw, would switching SwingLibrary from Subversion to Mercurial help 
contributing code?

Original comment by pekka.klarck on 22 Aug 2011 at 8:55

GoogleCodeExporter commented 9 years ago
We have already implemented this, but in Python in our own code (PyUseCase) so 
it's not really a patch yet. We're also still implementing our own support for 
popups, but I'm sure we can provide a patch for this eventually.

As for Mercurial, I think it's fair to say we aren't it's biggest fans :) but 
open source development is usually easier with some distributed system, yes. If 
you have more choices, I'd recommend Bazaar which we use, it's more flexible 
than Mercurial in how you work and handles directory structures and changes to 
them in a better way.

Original comment by geoff.ba...@gmail.com on 23 Aug 2011 at 7:16

GoogleCodeExporter commented 9 years ago
(Un)fortunately Google Code does not support bzr, so that's not an option.

We will probably migrate SwingLibrary to mercurial in near future.

Meanwhile, if you can share your Python workaround for this, I might be able to 
convert it to Java myself.

Original comment by janne.t....@gmail.com on 23 Aug 2011 at 10:45

GoogleCodeExporter commented 9 years ago
It is very simple for us to implement this because we already have instances of 
the component to be right clicked and the menu item to be selected, see the 
code below. I think you can get the component instance in the same way as you 
do in clickOnComponent keyword. The menu item instance could be more difficult 
to obtain. You have to assume that the popup is showing and then try to find 
the menu item on it.

===============================================================
from org.netbeans import jemmy

def activatePopup(self, component):
        operator = jemmy.operators.ComponentOperator(component)
        operator.clickForPopup()

def selectFromPopupMenu(self, menuItem):
        operator = jemmy.operators.JMenuItemOperator(menuItem)
        operator.push()

Original comment by daniel.g...@gmail.com on 31 Aug 2011 at 3:47

GoogleCodeExporter commented 9 years ago

Original comment by pekka.klarck on 13 Sep 2011 at 11:49

GoogleCodeExporter commented 9 years ago
Hi,
What is the status of this keyword enhancement.
I want to "Right Click" on a button and it popup menu items.
I am using SwingLibrary-1.2
SwingLibrary has Click on Component Keyword but it only allows double click and 
single click but no "Right Click"

Original comment by sharifud...@gmail.com on 21 Sep 2011 at 4:42

GoogleCodeExporter commented 9 years ago
I implemented Right Click on Component in 
https://github.com/robotframework/SwingLibrary/commit/a1dd0d5b3a59e67ec796fa48e5
18c3f620259f68

The second part, finding the dangling context menu and operating on it, is 
still missing.

Original comment by janne.t....@gmail.com on 3 May 2012 at 11:25