as

Saturday 30 May 2015

Writing the ranorex automation code without repository

If you know the xpath of the object, you can perform any operation on it using plain code without using repository. Additionally you do not even need to write the code in the Ranorex Studio. You can simply write the code in the most popular IDE in the world - Microsoft Visual Studio.
Just add the reference of the Ranorex core dll files in the project and you are ready to go!

Below code shows how I printed the value of the table cell in flex application hosted at Ranorex site

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Ranorex;
using System.Diagnostics;
namespace Ranorex
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {

           // Form x = Host.Local.FindSingle("/form[@title='Calculator']", 1000);
            //  x.Activate();

            Cell c = Host.Local.FindSingle("/dom[@domain='www.ranorex.com']//flexobject[@id='FlexExample']//Cell[@text='Maurice Smith']//..//preceding-sibling::Row//Cell[1]",2000);
            Trace.WriteLine(c.Text);
            Assert.AreEqual("Joanne Wall", c.Text, c.Text + "not matching");

        }
    }
}

What do you think on this topic? Please express your opinion or ask any question through comment below. You can write to me at reply2sagar@gmail.com

No comments:

Post a Comment

Leave your valuable feedback. Your thoughts do matter to us.

Sponsored Links

Popular Posts

Comments

ShareThis