Discussions » Development

Grabbing data off of webpage

§
Posted: 16-06-2018

Grabbing data off of webpage

Hello,

So recently I've gotten into a game and one thing led to another and so here I am trying to write my own script for it.

I basically know nothing about javascript but am currently going through the code academy lesson for it and am learning but what I want to know is how do you pull certain numbers from a webpage and to have the script read it.

What I am technically trying to do is grab a number from a web page to see if it is greater or less then a certain number. If greater then stop clicking and if less then keep clicking. I'm pretty sure there is a simple solution to this but as being as I am new I can't quite figure it out.

§
Posted: 17-06-2018

Taking a brief glance at what code academy shows for javascript, it doesn't look like it mentions DOM (Document Object Model). If it doesn't, you can learn about the DOM here: https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Introduction

More specifically on what you will need for your task, you will need the following: Open the browser inspector (usually Ctrl+Shift+i or Ctrl+Shift+k) and find the number in the DOM. Then in your javascript, use https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById or https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector to grab it from the DOM.

Post reply

Sign in to post a reply.