0

I wrote a JavaScript program that automates a process on a someone else's website, I run it on Chrome console and it works fine. I would like to do the same on my phone, but chrome mobile doesn't have console, any ideas?

So, I am NOT looking to debug or test the site or the script on a mobile environment, I actually need to run the script on a mobile phone rather than a PC.

I need to get the document object of the loaded page to get elements by ids and classes, and call click on them.

Is there a way of doing this?

ANSWER!!

As mentioned in the answer of the bookmark question above, I could run my JavaScript code on a mobile phone browser doing the same thing. The only issue I have is that the browser removes the JavaScript: part of the code at the begining, and I have to scroll all the way to the front to type it Thanks all

masood elsad
  • 434
  • 2
  • 6
  • 18
  • 1
    Haven't opened your original question yet, but you should have edited your original question to explain the difference between this and the duplicate rather than post another question. It was closed as a duplicate the first time probably because it looks the same. If it's different, it's your job to make that clear. – Lexi Oct 10 '17 at 17:29
  • 1
    If your previous question was closed as duplicate, posting the exact same thing will get the same result. – James Douglas Oct 10 '17 at 17:30
  • Something that might work without pc is typing javascript:code in url – juvian Oct 10 '17 at 17:31
  • I did edit the first one, but it frustrating that all thosr users reported it without understanding it, the referred question wad totally fdifferent – masood elsad Oct 10 '17 at 17:31
  • the question mentioned now had an aaccepted answer that is not suitable for me, so it is not a valid duplicate – masood elsad Oct 10 '17 at 17:33
  • Right. You know you don't need a console to be able to run javascript? – James Douglas Oct 10 '17 at 17:34
  • I need to read the document object in the loaded page to automate the process – masood elsad Oct 10 '17 at 17:36
  • Then you needed to comment on the original question to say it is not duplicate and then edit the question to differentiate it so that it can go back into the reopen queue for review. In other words, you say why that answer didn't help and clarify your question. Adding multiple of the same question until you get your desired response is generally not the best way to go. – Lexi Oct 10 '17 at 17:36
  • Will this work in mobile and on the loaded page? – masood elsad Oct 10 '17 at 17:39
  • this seems to be for a desktop – masood elsad Oct 10 '17 at 17:45
  • You can´t save it in mobile but you can run it – juvian Oct 10 '17 at 17:48
  • This actually worked, but for a complex script like mine, with multiple recurring functions might be hard to do. Will try it. – masood elsad Oct 10 '17 at 18:40
  • Hi Julian, it worked, but the issue is that the browser removes the JavaScript: part of the code at the begining, and I have to scroll all the way to the front to type it , any ideas? – masood elsad Oct 11 '17 at 06:25

1 Answers1

-1

You need to connect your device to your computer and access the console VIA the desktop chrome console. In the three little dot menu in the upper right corner, under more tools, there is and Remote devices options, click on it. enter image description here

You can then select the device under Devices and the open pages on your mobile chrome will appear, Simply click on the inspect button. ( Sorry I don't have an image for that )

P.S. Make sur your device is in Developper mode, the USB device is activated and that the connection type with your computer is set to transfer file. You should also check to make sure you have to phone driver installed on your computer but usually it's there.

Nicolas
  • 8,077
  • 4
  • 21
  • 51