Click(x,y) problem for paste

Post your questions and help other users.

Moderator: Martin

Post Reply
Skulledsky
Posts: 3
Joined: 23 Sep 2017 11:32

Click(x,y) problem for paste

Post by Skulledsky » 30 Sep 2017 15:04

My device is Android Moto G 3rd generation. I want to paste text in textbox like my password in browser webpage as I long click on box. When I give coordinates in click(x,y) on paste button after longclicking, it clicks on back screen instead of paste and so selected textbox gets unselected. I tried
focus (x,y),
sleep()
click(x,y)
and still have same result. I even tried it with paste(x,y).

I also tried to have an on-screen paste button on screen via an app:- "smart clip" but it shows a message when clicked "unable to paste".

I do not face any problem like screen overlay.

Maybe the website prevents such thing, so I tried disabling JavaScript and enabling dev scripting in site settings but still didn't achieved it.(Note:- The text can be manually pasted in that box when I click on paste by myself.)

The only thing I am left with is executing a root command click<x>,<y> on paste button. Should I proceed with rooting or not? Please help me to find a method to paste text in such box and let me know if root command would really work in this case or not.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Click(x,y) problem for paste

Post by Desmanto » 30 Sep 2017 17:09

What is the website you wanna visit and paste the password? If it is regular website that require you to do things manually, you are out of luck. But if it is a fixed one, where you have a set of things to be done, such as the web interface of router, then there are better ways to do it.

I used face the same problem, can't click x, y, except using root command. This is because most browser sandbox the UI inside, so the element inside the frame won't be visible to the host. Only raw input such as the click/input using root can pass thru it (since it is hardware event). But please don't root just for single purpose, you will regret it later. If the website has the mobile app version, then you have a chance to control it via the mobile app interface, which usually exposed the element to the OS.

The website I am trying to click x y is my modem management UI. I wanna automate the restart process of the mifi every night at 1 o'clock. So at first I also open the url at browser and use root click x, y. But that is not convenient, as during the process, I can't use my phone (to make sure I don't interrupt the process.) So I just use wireshark to check the traffic sent, repeat the whole process of restarting and analyze the http post sent. From there i replicate the same login token, username password format in the form field using action HTTP request and navigate to the restart uri command. Now I have automated the whole process, even expanding to check the mifi stat using the similiar command. It used to be several click away to the stat or restart command. Now it is just one click (shortcut) and the result is shown as toast message.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Skulledsky
Posts: 3
Joined: 23 Sep 2017 11:32

Re: Click(x,y) problem for paste

Post by Skulledsky » 01 Oct 2017 03:40

The site is of my university in-house group where I have to login by my username and password(I will try out HTTP command for that) which is common for my whole classroom, but ahead of it, I have to fill a text box with my college unique ID card number(which also include alphabets) for getting onto my own personal page(i.e. to obtain my college details like my exam scores,etc.) and hence so the site actions are fixed. For filling that text box by pasting from clipboard, I didn't found any HTTP command. Please let me know if there's one.

The keyboard pops up and the text box gets selected for writing by the focus and click command, but the click(x,y) do not work on my keyboard, instead it click on the back screen of webpage and so the box gets unselected and the keyboard pops down.(my keyboard contains a "paste it" button as a shortcut). I tried various keyboard input method but nothing happened.

As root click is a hardware event, it might do the job for pasting in that text box and clicking keyboard. So I think I would give it a try by keeping it my last option and so any alternatives are a safe bet.

Thanks for help.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Click(x,y) problem for paste

Post by Desmanto » 01 Oct 2017 06:05

If site action are fixed, then you have better chance to automating it via HTTP request. It is found in Action - HTTP request, not in script or Control UI. This is the example of my flow to restart my modem and check some info.
Image
Even If I share the flow, it will be useless. As it is specific for my modem. It is niche use, so we have to do it by ourself. The base flow actually not as complex as that, only about 7 action. But as I expand the functionality, grouping 3 flows into one, thus become the one above.

Using http request won't require any Control UI anymore, as you can see I have no Control UI elements at there. You will be dealing with http form field input. And later you have to use script to parse the response form the site. I don't need the full site, only need some of the data (as shown in the toast message). So I parse the response and output them as toast message.

To get the form field needed, you have to use laptop with wireshark installed and sniff only your outgoing/incoming traffic to the site. I don't know if it is breaking the policy at your university, but usually sniffing only your own traffic is not illegal. I mostly use wireshark for network troubleshooting, but yeah it can be used to do bad things, if coupled with another software. So do with your own risk. As long as you don't cross the path (combined with other software to sniff others' traffice), you won't have any trouble.

Minimize the traffic produced by the laptop by closing all other program (so there are less traffic). Open the browser and type the site address, but don't press enter yet. Start the wireshark and start capturing packet. Press enter to go the site and login as usual, until you get to the webpage you need to check for data. After that logout and stop capturing at the wireshark. Filter the packet to http protocol only. You will see a lot of traffic, but you only need the POST and GET. There is URI at the POST/GET, this is the one you can put in the HTTP request URL. For request method POST, usually you have form field and mostly it has login token. The token is usually retrieve from the first connection, so you have to use regex to parse the token and reuse it in the subsequent request (use debug dialog to check for response). You can put the usename, password, login token in the HTTP request POST form field, mimic the one you see at Wireshark. Following the POST/GET usually will lead you to the data that you need.

It is quite challenging to do it. You have to do it yourself, since the captured traffic contains your username and password. You won't let other to see it.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Skulledsky
Posts: 3
Joined: 23 Sep 2017 11:32

Re: Click(x,y) problem for paste

Post by Skulledsky » 03 Oct 2017 16:34

I am new to wireshark but sure, I will try it out. Thanks. :)

Post Reply