Page 1 of 1

Coded UI and Ranorex in Visual Studio

Posted: Mon Jan 29, 2018 11:05 pm
by QAAutomation
Hi All,

I'm new to Ranorex and i've just inherited an existing CodedUI project; Is it possible to use Ranorex with an application that CodedUI opened? My solution bellow unfortunately does not work. Thank you in advance!

Example:
//In Test.cs
[TestMethod]
public void Test1()
{
   //Open application using coded UI
   // Do some codedui work that will launch a web browser

   DoRanorexPart();
   
}
//In Ranorex.cs
[TestMethod]
public void DoRanorexPart()
{
    //initialize Ranorex
    Ranorex.Core.Resolver.AssemblyLoader.Initialize();

   // ??Can Ranorex Find an already opened WebDocument object?
   WebDocument webDocument = "/dom[@domain='Already_Opened_WebDoc.net']";
   
   InputTag fileName = webDocument.FindSingle("//input[#'FileName']");
   fileName.Click();
   
}

Re: Coded

Posted: Tue Jan 30, 2018 9:49 am
by odklizec
Hi,

The code looks OK to me. Could you please answer these questions?
- Ranorex version?
- Are you sure the domain name and input ID are correct?
- What exactly is your problem (exact error message)?
- Please provide a Ranorex Snapshot (not screenshot) of the element in question.

Re: Coded UI and Ranorex in Visual Studio

Posted: Tue Jan 30, 2018 4:53 pm
by QAAutomation
Thank you for the reply,

- Ranorex version?
8.0.0+git.6b58189a

- Are you sure the domain name and input ID are correct?
I copied the generated path from Ranorex Spy

- What exactly is your problem (exact error message)?
While running on Visual Studio 2013, Coded ui Test timed-out on line:
WebDocument webDocument = "/dom[@domain='Already_Opened_WebDoc.net']";
Test Result Message: Test 'Test1' exceeded execution timeout period.

- Please provide a Ranorex Snapshot (not screenshot) of the element in question.
See attached. I'm looking at the element browser and wondering if this is a element hierarchy i failed to implement. (testing that theory now)

[update 1]
It's probably not a hierarchy issue because it fails at the WebDocument level; That said maybe i need to identify Host?

[update 2]
I tried to do the following but it didnt work. (possibly even the wrong way of using host? i'll try to look for more sample uses of initializing host)
WebDocument webDocument = Host.Local.FindSingle("/dom[@domain='tradein-mocks.azurewebsites.net']");

[update 3 final]
You are correct; there is nothing wrong with the code. I was debugging the codedui test -- but Ranorex does not support that -- it works as expected when simple run is used. This is good!

Re: Coded UI and Ranorex in Visual Studio

Posted: Wed Jan 31, 2018 8:19 am
by odklizec
Hi,

My mistake ;) I tested the code in Ranorex Studio, where it works as expected.