You are not logged in.

#1 2019-05-15 10:08:32

From: Barcelona
Registered: 2019-04-23
Posts: 11

help - automate click HTML page using command line tool


I would like to be able to click on a button/anchor in an html page using some kind of command line tool. I am experimenting with lynx and it's fantastic. I can login in a page, click on the second link, enter in a form, fill it and send... all via automated command line scripts, using something like

lynx "http://mywebpage.php" -accept_all_cookies -cmd_script=steps_data.txt

where steps_data.txt is a textfile with the instructions (with link to click on, with fields I will fill, etc...).

But the final step of my scrits needs to click a buttom that has some javascript when you click on it. It's a page like that:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

    <META charset="utf-8"> 
    <META http-equiv="Content-Type" content="text/html;">
	function clickat() {
		alert("clicat !");


	<form name="marcajes" method="post" onsubmit="destination.php">
			<h1>Troublesome command line problem</h1>
			<input type="hidden" name="accion" id="accion" value="">
			<input type="submit" style="display:none;" id="confirmar2" />
			<input type="button" style="display:none;" id="confirmar" onclick="javascript:clickat();" />
			   <li>opcio 1</li>
			   <li>opcio 2</li>
			   <li><a href="#" style="font-size:1.2em;" onclick="document.getElementById('accion').value='finalitzacio';document.getElementById('confirmar').click();">THIS!!!!</a></li>
			   <li>opcio 4</li>


I can solve the problem with Java or PHP using something like Selenium. But in my crusade to learn as much as I can about command line tools.... it would be great to solve this with curl, lynx, wget or similar...

thx in advance !


#2 2019-05-17 04:54:17

Registered: 2015-09-29
Posts: 3,671

Re: help - automate click HTML page using command line tool

the addition of javascript makes the whole problem much, much harder and you should think thrice whether you can't solve the problem differently.

If you really can't, you need to look at software like phantomjs.
i am using it (optional) in my weather conky. i am not good with anything js. lots of searching of stackoverflow questions etc. was required.


#3 2019-05-17 07:01:52

Registered: 2015-12-16
Posts: 684

Re: help - automate click HTML page using command line tool

elinks has some basic JavaScript support.


Board footer

Powered by FluxBB