Jul-30-2019, 02:32 PM
Hello
I made a small python script that loads a website and then scrolls to the bottom of the page. I now would like to count all the instances in the page which have text ', no run,' and preferably show them in a column or data frame format. Can someone please tell me how can I do it and how can I load the fully scrolled data into a python variable?
Thanks! P.S. Below is the script that I wrote.
I made a small python script that loads a website and then scrolls to the bottom of the page. I now would like to count all the instances in the page which have text ', no run,' and preferably show them in a column or data frame format. Can someone please tell me how can I do it and how can I load the fully scrolled data into a python variable?
Thanks! P.S. Below is the script that I wrote.
from selenium import webdriver from selenium.webdriver.common.keys import Keys import time driver = webdriver.Firefox() driver.get('https://www.espncricinfo.com/series/11380/commentary/860281/sri-lanka-vs-pakistan-2nd-t20i-pakistan-tour-of-sri-lanka-2015') elm = driver.find_element_by_tag_name('html') elm.send_keys(Keys.END) time.sleep(3) elm.send_keys(Keys.END) time.sleep(3) elm.send_keys(Keys.END) time.sleep(3) elm.send_keys(Keys.END) time.sleep(3) time.sleep(3) elm.send_keys(Keys.END) time.sleep(3) time.sleep(3) elm.send_keys(Keys.END) time.sleep(3) time.sleep(3) elm.send_keys(Keys.END) time.sleep(3) time.sleep(3) elm.send_keys(Keys.END) time.sleep(3) time.sleep(3) elm.send_keys(Keys.END) time.sleep(3) time.sleep(3) elm.send_keys(Keys.END) time.sleep(3) time.sleep(3) elm.send_keys(Keys.END) time.sleep(3)