I investigated the problem and I have following results:
My toolbar contains about 300 buttons. Sorry, I can't attach snapshot but tree is following:
Code: Select all
form
toolbar
button1
button2
....
tabpagelist
tabpage1
tabpage2
...
tabpageN
buttonN
Steps:
1. Application opens
2. Default tab(Tab 1) is selected
3. Click on "Tab1" and click on button "ButtonOnTab1"
4. Click on "Tab3" and click on button "ButtonOnTab3"
5. Click on "Tab3" and click on button "ButtonOnTab3"
6. Click on "Tab1" and click on button "ButtonOnTab1"
7. Click on "Tab1" and click on button "ButtonOnTab1"
Result:
RibbonNavigationsSteps.NavigateToTabAndClickOnButton(Tab1, ButtonOnTab1) (7.4s)
RibbonNavigationsSteps.NavigateToTabAndClickOnButton(Tab3, ButtonOnTab3) (17.7s)
RibbonNavigationsSteps.NavigateToTabAndClickOnButton(Tab3, ButtonOnTab3) (31.1s)
RibbonNavigationsSteps.NavigateToTabAndClickOnButton(Tab1, ButtonOnTab1) (42.1s)
RibbonNavigationsSteps.NavigateToTabAndClickOnButton(Tab1, ButtonOnTab1) (52.6s)
How I'm selecting tab and clicking on button
Code: Select all
FindSingle<TabPage>(/form/toolbar/tabpagelist/tabpage[@title='Tab 1']).Click();
FindSingle<Button>(/form/toolbar/Button[@title='ButtonOnTab1' and @visible='true']).Click();
Also I tried to save toolbar element in CTOR and then I tried to somethigs similar, but the result was the same as above:
Code: Select all
//for tab selection
var tabs = application.Ribbon.Children.Single(x => x.GetAccessibleRole() == "PageTabList").As<TabPageList>();
tabs.Children.Single(x => x.As<TabPage>().Title == tabTitle).As<TabPage>().Select();
//for button pressing
application.Ribbon.Buttons.Single(x => x.GetAccessibleName() == btnName && x.Visible).Press();
Can somebody explain why it happens? And how to resolve performance degradation problem?