SetFocus() on UITestControl is throwing exception RRS feed

  • General discussion

  • Hi Team,

    I have recorded click action on Cell inside the ListView with CUIT. In Recorded code i am using SetFocus() on cell element before that click action. But when i am playing back the script, it is throwing an exception(PlayBackFailureException) if the cell is not in visisble state.

    I have the sample application and recorded CodedUI test also.Could you please share your mailid i will send it to you.

    Please let me know for further information.



    Thursday, August 28, 2014 9:08 AM

All replies

  • Maybe you think your message is 100% clear, it is not, in my idea not even for 10% where you write that you have a problem with a listview.

    Show the code which throws the exception.

    Be aware, this forum is not done by the team, it are just volunteers and for MSDN subscribers hired MSFT's 

    Also don't make from a question a discussion, in my idea there is nothing to discuss in your messa. 

    It is just an exception. Strange that you hide yourself behind such a crazy Nick by the way.


    Thursday, August 28, 2014 9:46 AM
  • Hi Cor,

    Ok, I understand your comment.  I am a naive user for this forum.

    I am facing a problem with CUIT in one of the scenario. From you previous reply I undrestand that we have to ask a question instead of making the post a discussion thread.

    I will repost it under appropriate section.



    Thursday, August 28, 2014 10:09 AM
  • You cannot set focus to a non-visible control.  Windows itself doesn't allow it and never has. 

    This is expected behaviour. 

    When you "recorded" this, the cell was visible but when "playing back" the script it's not - I would suggest that something is being "lost" in the "recording" process.   Does the Listview need to be scrolled to reach the required item, perhaps? 

    Regards, Phill W.

    Thursday, August 28, 2014 11:12 AM
  • Yes,

    We need to scroll down to reach the ListItem on which the action has to be performed. My script is unable to scroll to the required item,so I have used SetFocus API.



    Thursday, August 28, 2014 11:36 AM