Forum Discussion

sammy04's avatar
sammy04
Occasional Contributor
26 days ago

Button is recognized but is not clickable.

Hello everyone. I need your help to figure out why the button on my mobile app (Android) is not clicked even though TestComplete recognizes it. 

The code is very simple:

if completeButton.Exists:

 Log.Message("The button exists")

 completeButton.Click()

It returns "The button exists". However, the button is not clicked.

I suspect that the issue is because the button is partly covered with home icon as the image shows. Please tell me your thought and advice to fix this error. Cheers.

 

7 Replies

  • Hassan_Ballan's avatar
    Hassan_Ballan
    Icon for Champion Level 1 rankChampion Level 1

    Not a mobile expert but I am confident that some basic rules applies to desktop, web, and mobile.

    To be able to interact with a element it needs to exist, be enabled, and visible on screen not just visible.

    From the log where you get the error, the error should be descriptive and the error screenshot image should also point to where it is attempting to click. If the page is still loading and the button is in transit to its final location, the click could miss the moving target.

    • sammy04's avatar
      sammy04
      Occasional Contributor

      Thanks for the response, Hassan. However, the button didn't work even though it was touched correctly. Also tried to click the indicated location, but the button still didn't work.

  • scot1967's avatar
    scot1967
    Icon for Champion Level 1 rankChampion Level 1

    If I see issues like this I test for the focus state, after the click as well.  You may need to force focus?  You could be hitting the button and just moving focus.  What happens if you 'slow click'? (Two clicks with a short delay between?)   It looks like you are clicking the object and not using a position so it should just find and click the center no problem.

    ... If you find my posts helpful drop me a like! 👍 Be sure to mark the best answer if you get one to help others out and to credit the one who helped you.  😎

  • scot1967's avatar
    scot1967
    Icon for Champion Level 1 rankChampion Level 1

    You may also want to get with your Devs.  This does not seem to be an appropriate screen presentation for the user. It could be due to screen resolution and object placement? 

    • sammy04's avatar
      sammy04
      Occasional Contributor

      Thanks for your response, Scot. I tried to execute "focusd" and "SetFocus" for my object, however it says the button object does not support these property and method. I updated the testcomplete and tried again. But the result was the same.

      Addition: I found that focus property and method are used on desktop app not on a mobile app. I'm working on a mobile application.

      • rraghvani's avatar
        rraghvani
        Icon for Champion Level 3 rankChampion Level 3

        Could you try with either of the following line of code,

        completeButton.Touch()
        completeButton.Touch(5, 5)
        completeButton.Click(5, 5)