cancel
Showing results for 
Search instead for 
Did you mean: 

Can't catch exceptions

SOLVED
Highlighted
Occasional Visitor

Can't catch exceptions

error message is "The text was rejected."

 

The control reported that the text is invalid due to the following reason: "Reserved word can not be used".

Tested object:
Aliases.DIADesigner.HwndSource_MainWindowView.MainWindowView.ladderCanvas.ObjSymbolEditor
(Sys.Process("DIADesigner").WPFObject("HwndSource: MainWindowView", "DIADesigner - Adv. - Project1").WPFObject("MainWindowView", "DIADesigner - Adv. - Project1", 1).WPFObject("Grid", "", 1).WPFObject("Grid", "", 1).WPFObject("PART_ContentOffset").WPFObject("Grid", "", 1).WPFObject("PART_ContainerContent").WPFObject("Grid", "", 1).WPFObject("ContentControl", "", 1).WPFObject("ShellView", "", 1).WPFObject("Grid", "", 1).WPFObject("DockPanel", "", 1).WPFObject("barManager").WPFObject("DockPanel", "", 1).WPFObject("dockManager").WPFObject("Root").WPFObject("MainHost").WPFObject("TopHost").WPFObject("CenterHost").WPFObject("DocumentHost").WPFObject("FastRenderPanelContentControl", "", 1).WPFObject("DevDocumentPanelEx", "", 1).WPFObject("LayoutPanelContentPresenter", "", 1).WPFObject("LadderView", "", 1).WPFObject("Grid", "", 1).WPFObject("ContentControl", "", 2).WPFObject("LadderEditorView", "", 1).WPFObject("gd").WPFObject("ContentControl", "", 1).WPFObject("LadderCanvasView", "", 1).WPFObject("DockPanel", "", 1).WPFObject("CanvasScroll").WPFObject("ladderCanvas").WPFObject("ObjSymbolEditor", "", 1))
 
my code as below:
try:
  mainWindowView = Aliases.DIADesigner.HwndSource_MainWindowView.MainWindowView
  mainWindowView.BarContainerControl2.DXImage.Click(3, 7)
  mainWindowView.barContainerControl.DXImage.Click(10, 15)
  scrollViewer = mainWindowView.CanvasScroll
  scrollViewer.VScroll.Pos = 0
  scrollViewer.HScroll.Pos = 0
  ladderCanvasVM = mainWindowView.ladderCanvas
  ladderCanvasVM.Click(104, 40)
  ladderCanvasVM.ObjSymbolEditor.SetText("")  Aliases.DIADesigner.HwndSource_MainWindowView.MainWindowView.ladderCanvas.IntelliSenseListBox.WPFObject("Li  stBoxItem", "", 1).Click()
except Exception as e:
  Log.Error(str(e))
 
How can i do?  thanks a lot.
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: Can't catch exceptions

Hi,

 

try/catch are the means of the programming language to handle runtime errors like division by zero, memory access at 0x0 and the like. Also, these runtime errors may be simulated with the help of the throw.

 

Your code does not fail because of runtime problem: control exists, text can be entered into control and control can be clicked. Thus, no reason to throw an exception from the operating system point of view.

 

What you need to do to handle your case is to check whether or not the error message exists and proceed appropriately.

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================

View solution in original post

1 REPLY 1
Highlighted
Community Hero

Re: Can't catch exceptions

Hi,

 

try/catch are the means of the programming language to handle runtime errors like division by zero, memory access at 0x0 and the like. Also, these runtime errors may be simulated with the help of the throw.

 

Your code does not fail because of runtime problem: control exists, text can be entered into control and control can be clicked. Thus, no reason to throw an exception from the operating system point of view.

 

What you need to do to handle your case is to check whether or not the error message exists and proceed appropriately.

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================

View solution in original post