I am trying to scrape a table from the following site :
http://www.boursakuwait.com.kw/Stock/StkHData.aspx?STK=103
This is the following code that am using
ap = argparse.ArgumentParser()
ap.add_argument("--id",required = True, help = "enter the id")
ap.add_argument("--from",required = True, help = "From date")
ap.add_argument("--to",required = True, help = "To date")
args = vars(ap.parse_args())
id_num = args["id"]
from_date = args["from"]
to_date = args["to"]
browser = webdriver.Firefox()
url1 = "http://www.boursakuwait.com.kw/Stock/StkHData.aspx?STK=" + id_num
browser.get(url1)
elem = browser.find_element_by_id("ContentMatter_txtFrom")
elem.send_keys(from_date)
elem = browser.find_element_by_id("ContentMatter_txtTo")
elem.send_keys(to_date)
elem = browser.find_element_by_id("ContentMatter_Button1").click()
time.sleep(5)
parsed = requests.get(url1)
soup = BeautifulSoup(parsed.text,'html.parser')
tble = soup.findAll("table",attrs={"class":"hoverTable"})
print(tble)
After entering the from and to date, and simulating the button click, my goal is obtain the resulting table. However, the code does not recognize the table. I have tried other forms of the code as well (looping through rows and cols), but they haven't worked either.
My guess is that the url doesn't get updated, since it is a hoverTable. Is there a way to obtain the table in this case?
P.S: the id_num are integers, 101,102,103 etc. displaying the respective stocks of the companies. The link pasted comes with id 103. STK=103