Skip to content

Click on a view without text or resource-id ? #326

Description

@sooraj-sizon-pj

<node NAF="true" index="0" text="" resource-id="" class="android.widget.EditText" package="com.example.status" content-desc="" checkable="false" checked="false" clickable="true" enabled="true" focusable="true" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[187,794][893,902]" /></node>

This is an EditText , I would like to enter a value into this edittext would it be possible to do this without resource-id or text ?

Activity

  1. dtmilano commented on Jul 1, 2024

    @dtmilano
    Owner

    Do you have the bounds?

    bounds="[187,794][893,902]"
    
  2. sooraj-sizon-pj commented on Jul 3, 2024

    @sooraj-sizon-pj
    Author

    Do you have the bounds?

    bounds="[187,794][893,902]"
    

    Right , can you please share an example usage using bounds ?

  3. dtmilano commented on Jul 4, 2024

    @dtmilano
    Owner

    If you know the bounds, you can enter text by touching the view to get focus and type

    #! /usr/bin/env python3
    
    from com.dtmilano.android.viewclient import ViewClient
    
    device, serialno = ViewClient.connectToDeviceOrExit()
    
    bounds = ((137, 743), (933, 897))  # you know the bounds
    (l, t), (r, b) = bounds
    x = l + (r - l) / 2
    y = t + (b - t) / 2
    device.touch(x, y)
    device.type("Hello World!")
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions