So I am trying my hand on selenium to scrape data from a website, as still new to selenium and web scraping I am stuck. I want to scrape some data which is present under <script type> tag, the tag looks like this:
...
...
<script type="text/javascript">
var myData_1 = {"name" : ..... };
var myData_2 = {......};
var myData_id = 4565843;
var myData_mapping = {.....};
</script>
...
...
So I need to scrape data present in this script tag i.e. all var data values. Till now I have coded down only this much:
from selenium import webdriver
import pandas as pd
driver = webdriver.Chrome('/home/slothfulwave612/chromedriver_linux64/chromedriver')
driver.get('https://www.example.com') ## not the actual site
html = driver.page_source
print(html)
driver.close()
This is just printing the source code for the website, what should I add here so that I can scrape the data from <script type tag. Can somebody help?