Using Ranorex with Python

Class library usage, coding and language questions.
jtruppia
Posts: 11
Joined: Sat Oct 22, 2011 12:35 am

Using Ranorex with Python

Post by jtruppia » Fri Nov 04, 2011 3:41 pm

I've seen some old posts about this, but nothing newer than 2008.
Is it still possible to use Ranorex with Python? Using IronPython maybe? That should work, cause it uses the CLI, right? Any code examples available?

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

Re: Using Ranorex with Python

Post by Support Team » Mon Nov 07, 2011 12:39 pm

Hi,

please have a look at following forum post:
http://www.ranorex.com/forum/sooo-what- ... tml#p10238

Regards,
Tobias
Support Team
.
Image

jtruppia
Posts: 11
Joined: Sat Oct 22, 2011 12:35 am

Re: Using Ranorex with Python

Post by jtruppia » Mon Nov 07, 2011 4:40 pm

Thanks, it's a shame cause Python is such a good language to do scripting, really useful for testing.
For anyone who ends up here, it might be useful to know that I'm currently using Ranorex 3.0.5 and IronPython 2.7.1 with success. However, I don't use Ranorex Studio, only the Spy and its generated code (IronPython code, please don't take that out!!!) and Visual Studio (with PVST, Python Visual Studio Tools) and it works (there are some things with IntelliSense, but that's more a PVST bug)

I have one question left, is there a way to do in Python something similar to what the following code does in C#

Code: Select all

Ranorex.Button but = "<RanorexPath to the button>"

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

Re: Using Ranorex with Python

Post by Support Team » Mon Nov 07, 2011 5:26 pm

jtruppia wrote:Thanks, it's a shame cause Python is such a good language to do scripting, really useful for testing.
As I wrote in the other forum thread, you can still use IronPython with Ranorex. It's just that the Ranorex tools won't generate IronPython code any more. However, you can still create assemblies containing repositories and recordings in C# or VB and then use them in your IronPython code.
jtruppia wrote:only the Spy and its generated code (IronPython code, please don't take that out!!!)
I'm really sorry, but we have already removed that functionality with Ranorex 3.1, since it was not working reliably with all Ranorex features. Just can still just create your repository in C#, compile it to a DLL and use that DLL from IronPython.
jtruppia wrote:I have one question left, is there a way to do in Python something similar to what the following code does in C#
Python does not have explicit variable declarations, but you can do the following:
form = Ranorex.Form("/form[@title='Calculator']")
Regards,
Alex
Ranorex Team
.
Image