2

So I want to make my computer do a certain thing on a website every 30 minutes, for 2 days straight. I want my computer to post something on a site and the title have to show the time. Does anyone know a program that can do this?

I use Windows.

  • 1
    Developers would use Selenium. Can you give a bit more of background regarding the knowledge of the user (i.e. you if I understand that right). Is programming ok or do you need a simple UI? – Thomas Weller Jul 7 '16 at 6:17
3

Here are the options I can suggest (in no particular order):

  1. Selenium. This is an automation tool for web browsers. It is typically used by developers for running web site testing scripts, but can be used for any purpose that requires a repeatable action on a website. you would write a script telling it to "click on this, enter that, etc", and could run it repeatedly. It works with all the major browsers. You'd still need a separate tool to set it to run on a regular basis.

  2. Sahi. Similar to Selenium. Arguably easier to use, but not as widely supported. It does still work in all the major browsers though. As with Selenium, you would still need a separate tool for scheduling it to run.

  3. PhantomJS. This is a bit different to the others. Phantom is a "headless web browser"; that is, it's a fully functional web browser, but without a user interface. You can use it to navigate pages, but all interaction with it is done through scripting it, both for telling it what to do and for inspecting the resulting web pages. As with the other two tools above, it is frequently used for writing test scripts for web sites. It is considerably quicker at running its scripts than Selenium or Sahi due to not having the overhead of having to load a separate browser and not having to render the browser window on screen. The learning curve is steeper considerably though, so it will take you more effort to get it up and running. As with the others, you'll need a separate tool for automating it to run regularly.

  4. WGet. Depending on your needs, you might not need anything of the complexity of the tools listed above. WGet is a very simple tool that does nothing else but to make a web request. If your automation need is a simple one -- eg just load a given page to activate an event on your site once a day -- then you may be able to achieve it just be loading the page; you don't necessarily need to have a browser doing anything with the page once it's loaded. In this case, WGet may be a better option than any of the others, just because it's so simple. Again, you'll need something else to tell it to run on a regular basis.

For all of the above, once you've written the script, getting it to run regularly can be achieved using the Windows Task Scheduler, which is built into Windows.

One final thing I would say: If the action you're performing regularly is an action on your own website, you might be better off having it done by the web server itself. In this case, assuming your server is running Linux, you'd need to use a cron job to perform the automation, but you wouldn't need any of the tools above, as your cron job could simply run the code on your site directly.

| improve this answer | |
0

Since you said "website", you can use your browser to get the job done. Although Selenium can be used as well.

I'll be using browser.

Disclaimer: Intermediate Javascript knowledge is required to accomplish this.

Here these are your best friends, exploit them: setInterval, iframes, MouseEvents, KeyboardEvents

You go to target website, open browser's console and enter the script (more on that later).

Browser's main window/tab will keep your script running, iframes will act as a second layer sandbox for your script, because triggering clicks on main page might redirect to some other page thus stopping your script further.

And then use normal selectors and MouseEvents/KeyboardEvents to accomplish what you want.

Example:

This example script will upvote first reply posted on most recent thread on reddit.com/r/webdev

Warning: You must be logged into reddit

1. Open your browser (Tested on Chrome)

2. Go to reddit.com/r/webdev

3. Open console by CTRL + SHIFT + J

4. Paste the following code and hit enter (explained later)

You can leave now, just make sure browser is kept running.

What's happening??

The main helpers here are setInterval and iframes. Former keeps it looping and latter is used to execute scripts and the window itself is used to maintain environment.

Set the end time for the script

var endLoopAt = new Date('July 08, 2016 08:24:00');

Create a sandboxed environment, main window will be used to keep script running

var sandBoxedIframe = document.createElement("iframe");
sandBoxedIframe.onload = checkAndUpvote;
document.body.appendChild(sandBoxedIframe);

Used to check if the new most recent link is same as one checked during last run

var lastUpdatedFirstPostLink = "";

Rest of the script uses element selectors (You can use "inspect element" to find yours) and dispatches Events on them.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.