Ranorex equivalent of Selenium's PageFactory

Ask general questions here.
benny28
Posts: 34
Joined: Thu May 31, 2012 4:48 pm
Location: London
Contact:

Ranorex equivalent of Selenium's PageFactory

Post by benny28 » Sun Oct 27, 2013 11:05 pm

Hello All

In my .Net project I am manually building my automation framework using Ranorex library:
* Ranorex dll's in my project references
* Specflow
* Page Object Pattern design
etc

When I have done this previously using Selenium Webdriver I used the PageFactory implementation to simpify my Step Definition code to: class name.element name.selenium action();
(example: _allShared.Ok.Click();)
... as opposed to driver.FindElement(By.XPath(AllShared.Ok)).click();

Is there a feature similar in Ranorex for me to implement this: class name.element name.selenium action();
... as oppsed to Ranorex.Mouse.Click("xpath") everytime.


Here is the sample code using Selenium that I would like to achieve using Ranorex:::

In my page objects class:

Code: Select all

using OpenQA.Selenium.Support.PageObjects;

public class AllShared
    {        
        [FindsBy(How = How.XPath, Using = "//input[@type='ok']")]
        public IWebElement Ok;
    }

In my Step Definitions class:

Code: Select all

[Given(@"I select ok")]
        public void GivenISelectOk()
        {
            PageFactory.InitElements(driver, _allShared);
            _allShared.Ok.Click();
        }
Thanks in advance :D

benny28
Posts: 34
Joined: Thu May 31, 2012 4:48 pm
Location: London
Contact:

Re: Ranorex equivalent of Selenium's PageFactory

Post by benny28 » Tue Oct 29, 2013 10:58 pm

Hi Ranorex Support team, any thoughts on this :?:

Does my question makes sense to you?

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

Re: Ranorex equivalent of Selenium's PageFactory

Post by Support Team » Wed Oct 30, 2013 6:46 pm

Hi,

I am not totally sure I got you correctly, but I think the Ranorex repository could be what you search for.
Do you know the repository and how to use it?
Here is a link to the section in our UserGuide: UI Mapping with Ranorex Repository.
I would also suggest watching the screencast "Introducing Ranorex Repository with Automated Generation", here is the link: Screencasts.
This will give you a brief overview about how the repository works and how to use it.

Regards,
Markus
.
Image