how to validate file names

Best practices, code snippets for common functionality, examples, and guidelines.
Aaparna16
Posts: 1
Joined: Mon Sep 28, 2020 3:22 am

how to validate file names

Post by Aaparna16 » Mon Sep 28, 2020 3:37 am

Hi All,
I am new to Ranorex. I have below requirement-
Few pdf files are placed in below location and i need to extract name of all the files.
location: H:\Test\Project
I am trying to code using C#. But the below code is not working.
Thanks for the help!

IList<Ranorex.Text> childLstItems = GlobalVariable.repo.RNDIDDTEST.ItemsView.FindChildren<Ranorex.Text>();
for(int i=0; i<=childLstItems.Count-1; i++)
{
if((childLstItems).TextValue == "testfile") //this is a pdf file name that i am trying to validate
{
Report.Success("Successfully login");
}
}

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: how to validate file names

Post by odklizec » Tue Sep 29, 2020 7:16 am

Hi,

I assume you are trying to get the list of files from an UI element? In this case, please post a Ranorex snapshot (NOT screenshot) of the element in question. Without, at very least, snapshot, it's very hard to suggest something reliable. Thanks.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration