Click here to Skip to main content
15,792,397 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have made a application. In it's UI I have a button when I click on it an open file dialog box opens up I have made this dialog box using the OpenFileDialog(). There is a open button inside this dialog box. I want to automate the UI TESTING of my application for which I need it to click on the open button but winappdriver is not able to locate and click on this button. I tried to locate it using automationid xpath name classname but nothing worked.

What I have tried:

I have tried to find the open button using classname xpath automation id but nothing worked..
Updated 16-May-23 5:04am
RickZeeland 19-Sep-19 8:20am    
Is this a Winforms, WPF or Web application ?
TANYA DHEER 20-Sep-19 0:29am    
it is a WPF application
RickZeeland 20-Sep-19 2:07am    
Did you try using the UI Recorder ?
TANYA DHEER 20-Sep-19 2:25am    
yes i used the UI recorder and i found the automation id for the open button to be "1" in the ui recorder but when i used session.findelementbyaccessiblityid("1").Click(); it was still not able to locate that button i tried the samme with xpath but nothing worked

Share this answer
Just a guess, but are you using the application session to find the file open dialog's button? Try using a DesktopSession instead. The dialog is not a child of the application window and this not in its tree whereas the DesktopSession would be rooted at the Windows level and have access to everything.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900