How to right click on a web element in IronPython?

Class library usage, coding and language questions.
piotrn
Posts: 16
Joined: Fri Mar 25, 2011 3:04 pm

How to right click on a web element in IronPython?

Post by piotrn » Thu Jul 28, 2011 4:13 pm

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

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

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

Post by Support Team » Thu Jul 28, 2011 4:53 pm

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
.
Image

piotrn
Posts: 16
Joined: Fri Mar 25, 2011 3:04 pm

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

Post by piotrn » Fri Jul 29, 2011 2:39 pm

Hi
The provided explanation works great.
Thanks :)