Page 1 of 1

How to right click on a web element in IronPython?

Posted: Thu Jul 28, 2011 4:13 pm
by piotrn
Hi

It's unclear how to right click on a web element in IronPython.
Also MouseButtons is not really documented in the latest Ranorex version.
The following code is not working but possibly it should...

Code: Select all

import clr
clr.AddReference('Ranorex.Core')
import Ranorex
....
# di is LiTag
di.Click(Ranorex.MouseButtons.Right)
The error from IronPython is:
di.Click(Ranorex.MouseButtons.Right)
AttributeError: attribute 'MouseButtons' of 'namespace#' object is read-only
Regards

Re: How to right click on a web element in IronPython?

Posted: Thu Jul 28, 2011 4:53 pm
by Support Team
piotrn wrote:Also MouseButtons is not really documented in the latest Ranorex version.
The MouseButtons enumeration is not a Ranorex specific class, but one of the .NET Framework. Consequently, you can find the documentation on MSDN:
http://msdn.microsoft.com/library/syste ... ttons.aspx
piotrn wrote:The following code is not working but possibly it should...
That code cannot work, since the MouseButtons enumeration is not in the Ranorex, but in the "System.Windows.Forms" namespace. The following code should work:
clr.AddReference('System.Windows.Forms')
import System.Windows.Forms
...
di.Click(System.Windows.Forms.MouseButtons.Right)
Regards,
Alex
Ranorex Team

Re: How to right click on a web element in IronPython?

Posted: Fri Jul 29, 2011 2:39 pm
by piotrn
Hi
The provided explanation works great.
Thanks :)