Hi
Is it possible to get a valid IronPython (IronPython 2.7 (2.7.0.40) on .NET 4.0.30319.1)
code example? The example provided in the Ranorex User Guide: Visual Studio Integration does not really work.
I've tried with the following modified version but still 'Form' (and other Ranorex classes) cannot be found....
------------------------------
import clr
clr.AddReferenceByPartialName("System.Drawing")
clr.AddReferenceByPartialName("IronPython")
clr.AddReferenceByPartialName("Ranorex.Core")
clr.AddReferenceByPartialName("Ranorex.Controls")
from System.Drawing import *
from Ranorex.Core import *
from Ranorex.Controls import *
import System
import IronPython
def Main():
error = 0
try:
System.Diagnostics.Process.Start("calc.exe")
form = Form(Host.Local.FindChild("Calculator"))
form.Activate()
button = Button(form.FindChild("2"))
button.Click()
button = Button(form.FindChild("*"))
button.Click()
button = Button(form.FindChild("3"))
button.Click()
button = Button(form.FindChild("="))
button.Click()
except Exception, e:
print(e.ToString())
error = -1
return error
Main()
------------------------------------------------------------------
IronPython code example
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: IronPython code example
Hi,
Here is a little example:
Regards,
Roland
Ranorex Support Team
Here is a little example:
Code: Select all
import clr
clr.AddReference('Ranorex.Core')
import Ranorex;
bt = Ranorex.Button("/form[@controlname='formVipApplication']/button[@controlname='btAdd']")
bt.Click()
Roland
Ranorex Support Team