I am using bottle to host a simple html page which changes the page title on load. The HTML page code:-
<html>
<head>
<title>title</title>
<script type="text/javascript">
function initialize(){
var z=1234;
document.title = z;}
</script>
</head>
<body onload="initialize();">
hi
</body>
</html>
My bottle hosting code:
from bottle import route, run, template
@route('/:anything')
def something(anything=''):
return template('C:/test1.html')
run(host='localhost', port=8080)
I am trying to capture the updated document.title using python. so far I have tried urllib,mechanize,htmlparse but all of them were returning "title" instead of 1234.
a sample mechanize code that I have tried is:
from mechanize import Browser
br = Browser()
br.open("http://localhost:8080/hello")
print br.title()
Please help me.