Why Ghost is failing to see the javascript
avinassh opened this issue · 1 comments
avinassh commented
I am new to Ghost and I want to know if I am doing anything wrong. Following is the page content:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Javascript scraping test</title>
</head>
<body>
<p id='intro-text'>No javascript support</p>
<script>
document.getElementById('intro-text').innerHTML = 'Yay! Supports javascript';
</script>
</body>
</html>
And here's my simple code:
>>> page, extra_resources = ghost.open(url)
>>> soup = BeautifulSoup(page.content)
>>> soup.find(id="intro-text")
<p id="intro-text">No javascript support</p>
Deleted user commented
You should wait the page loaded. Your program exits instantly when ghost gets the html code. The js didn't get executed.