Automating for Office versions

Ask general questions here.
Posts: 4
Joined: Fri Aug 03, 2018 3:42 pm

Automating for Office versions

Post by AdrianL » Fri Aug 03, 2018 3:52 pm

Testing between versions of Microsoft Office Microsoft have changed the hierarchy of backstage view

so in word 2010 the paths looks like
/form[@title='Document1 - Word']//container[@automationid='BackstageView']/list[@automationid='NavBarMenu']/listitem[@name='Print']

and in Word 2013 it looks like
/form[@title='Document1 - Word']//container[@automationid='BackstageView']/contextmenu[@automationid='NavBarMenu']/tabpage[@name='Print']

could I switch repositories so could put all 2016 in one and all 2013 at runtime after detecting the version of The office Application started?
or switch the repository object string dependent on the version?

Or is there a better way other than creating new tests for each version?

Thanks Adrian

User avatar
Posts: 135
Joined: Mon Jul 11, 2016 4:01 pm

Re: Automating for Office versions

Post by N612 » Mon Aug 06, 2018 9:33 pm

I would keep it simple and just make the RanorexPaths more robust to work in both versions. Check out the "New" path below that I created by replacing the different element types with wild cards.

Code: Select all

2010: /form[@title='Document1 - Word']//container[@automationid='BackstageView']/list[@automationid='NavBarMenu']/listitem[@name='Print']
2013: /form[@title='Document1 - Word']//container[@automationid='BackstageView']/contextmenu[@automationid='NavBarMenu']/tabpage[@name='Print']
New:  /form[@title='Document1 - Word']//container[@automationid='BackstageView']/*[@automationid='NavBarMenu']/*[@name='Print']
As long as there are no other elements with name='Print' under an element with the automationid='NavBarMenu', this should work well. You can add more attributes to the wildcard elements to make it more accurate while keeping the element type wild.