Coded UI and Ranorex in Visual Studio

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
QAAutomation
Posts: 3
Joined: Mon Jan 29, 2018 9:11 pm

Coded UI and Ranorex in Visual Studio

Post by QAAutomation » Mon Jan 29, 2018 11:05 pm

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();
   
}
Last edited by QAAutomation on Tue Jan 30, 2018 4:22 pm, edited 1 time in total.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3948
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Coded

Post by odklizec » Tue Jan 30, 2018 9:49 am

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.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

QAAutomation
Posts: 3
Joined: Mon Jan 29, 2018 9:11 pm

Re: Coded UI and Ranorex in Visual Studio

Post by QAAutomation » Tue Jan 30, 2018 4:53 pm

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!

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3948
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Coded UI and Ranorex in Visual Studio

Post by odklizec » Wed Jan 31, 2018 8:19 am

Hi,

My mistake ;) I tested the code in Ranorex Studio, where it works as expected.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration