Ask a Question

Click on the selected item of a tabstrip control in WinForms.

ussainik
Occasional Contributor

Click on the selected item of a tabstrip control in WinForms.

I am trying to automate a winforms application and when I use the object spy, it says its a tab strip control name is tabstrip1. How do I click/select the different tabs based on the name?

 

I try something like this but it doesn't work

//Aliases.EchoClientUtility.EchoClientApplicationForm.splitContainerMain.SplitterPanel.splitContainerUpper.SplitterPanel2.tabControl.tabStrip1.Click(178, 14); I don't want 178,14, I want to click based on the name.
//Aliases.EchoClientUtility.EchoClientApplicationForm.splitContainerMain.SplitterPanel.splitContainerUpper.SplitterPanel2.tabControl.WinFormsObject("tabControlPanelSurvey")
Aliases.EchoClientUtility.EchoClientApplicationForm.splitContainerMain.SplitterPanel.splitContainerUpper.SplitterPanel2.tabControl.tabStrip1.Click("tabControlPanelSurvey");

tab.PNG

 

12 REPLIES 12
ussainik
Occasional Contributor

For the first question, for some reason the tab is not highlighted but the whole container below the tab control highlighted.

 

For the second, If I am on an other tab other than Survey, it complains "Unable to find object tabControl("tabControlPanelSurvey")."

 

rraghvani
Trusted Contributor

rraghvani_0-1678982378345.png

 

"tabControl" is not a specific tab, but can be considered as a container for tabs.

 

I think your other tabs are dynamically created when clicked on. Hence, TC won't be able to recognise the tab names. Ask your developers if they can some how make the tabs static.

ussainik
Occasional Contributor

Sure thanks for the clarification. I think they are being added dynamically.

cancel
Showing results for 
Search instead for 
Did you mean: