Wednesday, 13 October 2021

python Selenium - Unable to fetch Facebook table content

I am trying to access this, here I have to fetch table under 'Pages to Watch section. enter image description here I am getting timeout exception.

Below is my code:

chrome_options = webdriver.ChromeOptions()
prefs = {"profile.default_content_setting_values.notifications" : 2}
chrome_options.add_experimental_option("prefs",prefs)
driver = webdriver.Chrome(chrome_options=chrome_options)



driver.get(url)
driver.maximize_window()

time.sleep(3)

elem = driver.find_element_by_id("email") #m_login_email
elem.send_keys(usr)

elem = driver.find_element_by_id("pass") #m_login_password
elem.send_keys(pwd)

elem.send_keys(Keys.RETURN)

time.sleep(10)

users_list = [] 

delay = 60 # seconds
try:
    myElem = WebDriverWait(driver, delay).until(EC.presence_of_element_located((By.ID, 'profile_page_insights_hubble')))
    print("Page is ready!")
except TimeoutException:
    print("Loading took too much time!")

I dumped the driver variable content in the html file and I got the blank content from where I want to scrape the data. enter image description here

Where am I going wrong?, Kindly assist



from python Selenium - Unable to fetch Facebook table content

No comments:

Post a Comment