cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to identify the end of Panel

Highlighted
Contributor

Unable to identify the end of Panel

Hi,

I'm working with WPF objects. Developers have hidden the Scroll bar within the Panel. Now the situation is I'm unable to find the last object in the tree.

What I want to achieve is to search the items in the panel. It searches the panel in top to down approach but if I provide random list then when it reaches the end it doesn't start from top again.

I'm using MouseWheel(-1) to scroll down but it keeps scrolling continously.

Please find the screenshot of the all.

Please let me know how to script it to find end and start again from top.

I tried MouseWheel(1) and Object.Exists and Object.VisibleonScreen still it working for all the files.  It works for 1 or 2 files but later it fails again.

5 REPLIES 5
Highlighted
Community Manager

Re: Unable to identify the end of Panel

Community, your thoughts? 

 

@tristaanogre@Marsha_R@AlexKaras@cunderw ?

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Highlighted
Community Hero

Re: Unable to identify the end of Panel

I would look into using "FindAllChildren" against the container of the tree itself to search for all items within the panel.  This will find all that are visible on screen and not, just listing what's in the panel.  This returns an array that you can just loop through from 0 to array length -1... and you can just loop through that as many times as you want.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Highlighted
Contributor

Re: Unable to identify the end of Panel

Hello,

 

Sorry for late reply!!

I have already tried FindAllChildren, it didn't work for me. It was getting stuck at the end and couldn't go back to top unless I provide mousewheel(1) but with providing mousewheel(1) & mousewheel(-1) the script was just rotating up & down at same location.

So finally I have to ask for solution in community. If you need I can share my code too.

Highlighted
Community Hero

Re: Unable to identify the end of Panel

Yes, please... share your code.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Highlighted
Contributor

Re: Unable to identify the end of Panel

Code from my application

set CalConfigTab = Aliases.TrainBraC_NG.HwndSource_ShellViewRibbonWindow.ShellViewRibbonWindow.DockTGP.PanetabitemCalculationConfiguration
set BrakeCaseTab = Aliases.TrainBraC_NG.HwndSource_ShellViewRibbonWindow.ShellViewRibbonWindow.DockTGP.TabControl.BrakeCaseTab

Function BrakeCalTypeCopy
  
  Dim Driver,Path
  Path = Project.Path
  CalConfigTab.Click
  BrakeCaseTab.Click
  set CalPanel = Aliases.TrainBraC_NG.HwndSource_ShellViewRibbonWindow.ShellViewRibbonWindow.DockTGP.ContentpaneConfigurationTree.Grid.StackPanel
  set BtnExpand = CalPanel.FindChild(Array("WPFControlName", "WPFControlOrdinalNo"), Array("BtnExpandAll","1"),50)
  ToolT = BtnExpand.ToolTip
  log.Message ToolT
  if Not (ToolT="Collapse Items") then  BtnExpand.Click
  set defBr = Aliases.TrainBraC_NG.HwndSource_ShellViewRibbonWindow.ShellViewRibbonWindow.DockTGP.ContentpaneConfigurationTree.Grid.CalcTree
  ParamFoundBool=False
  PasteFoundBool=False
  set Driver = DDT.ExcelDriver(Path&"TestData\PrjData\PrjData.xlsx", "BrCTCopy", true)
  While Not Driver.EOF
  copyname= DDT.CurrentDriver.Value(1)
  BrParent= DDT.CurrentDriver.Value(0) 
  for i=0 to defBr.ChildCount*20
  copypartarr = defBr.FindAllChildren(Array("Text","ClrFullClassName"),Array(copyname,"System.Windows.Controls.TextBlock"),50)
  for each copypart in copypartarr
  'Sys.HighlightObject copypart
  BrcParent=copypart.DataContext.Parent.Name
  if (BrcParent=BrParent) then
  copypart.ClickR
  defBr.PopupMenu.Click("Copy")
  ParamFoundBool=True
  pastename= DDT.CurrentDriver.Value(2)
  if Not(pastename="NA") then
  for j=0 to defBr.ChildCount*20
  set pastepart= defBr.FindChild(Array("Text","ClrFullClassName","WPFControlName"),Array(pastename,"System.Windows.Controls.TextBlock","BCName"),50)
  'Sys.HighlightObject pastepart
  if(pastepart.Exists) then 
  pastepart.ClickR
  defBr.PopupMenu.Click("Paste")
  PasteFoundBool=True
  end if 
  exit for 
  next
  defBr.MouseWheel(-1)
  end if
  If PasteFoundBool=True then
  Exit for 
  end if
  end if
  If ParamFoundBool=True then
  Exit for
  End if
  next
  defBr.MouseWheel(-1)
  If ParamFoundBool=True then
  Exit for
  End if
  next 
  Call Driver.Next()
  WEND
  Call DDT.CloseDriver(Driver.Name)
End Function
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors