Forum Discussion

xiemojia's avatar
xiemojia
Contributor
13 years ago

How to avoid TC throw java.awt.IllegalComponentStateException to log

    Hi, All,



    I encountered "java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location" in log



when I tested JavaApplet. 



    Although I found the root cause, that is, some object collection is no VisibleOnScreen, so some attributes



like " 'Left' 'ScreenLeft' 'ScreenTop'  'Top' " throw the above error. When I use findAll to filter these objects, then the error log appeared.



    Could somebody give me some tips about this problem( Please refer the pic in attachment). Thanks in advance!!!





    

3 Replies


  • Hi Mojia,





    Could you please describe how the errors affect your tests? As I understand, you call the FindAll method to get an object, but the method fails due to the errors and therefore the needed object is not returned. Is this so? Or the method actually returns the object you need, but you just don't want the error messages to be posted to the test log?


  • Hi, Allen  

            

        It can return the correct object, only affect my log file. As you say " Or the method actually returns the object you need, but you just don't want



    the error messages to be posted to the test log  ". If I use TC log, there is a lot of errors in it, I want to eliminate these errors not in my control. 



        Thanks!!
  • Hi Mojia,



    I suppose the errors you get are caused by some peculiarities of the controls' implementation (some properties of Java controls throw exceptions when the controls are invisible, as far as I know). So, if you simply need to remove the messages from your test, you can create an event handler for the OnLogError event as described in the Creating an Event Handler for the OnLogError Event help topic.