Data Scraping, but main content return value none

Viewed 20

I am able to login properly, keep the session and browse other pages but after doing print(driver.get(full_path)) the return value shows None. I don't understand why it's showing None. But when I run the script I can see the pages being browsed.

Even though I've tried other ways to get data, the same results are showing all the time, like None.

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
import time
import pathlib,pickle
from bs4 import BeautifulSoup as bs
import requests
import pandas as pd

# Github credentials
email = ""
password = ""

# initialize the Chrome driver
driver = webdriver.Chrome("")


login_path = "https://finbox.com/login/email"

def save_cookies_file():
    driver.get(login_path)
    
    # login info
    driver.find_element(By.NAME, 'email').send_keys(email)
    driver.find_element(By.NAME, 'password').send_keys(password)
    
    # submit button
    driver.find_element(By.CLASS_NAME, '_105e3d41').click()
    
    pickle.dump(driver.get_cookies(), open("cookies.pkl", "wb"))
    time.sleep(10)

save_cookies_file();



""" cokies detials """
def search(text):    
    cookies = pickle.load(open("cookies.pkl", "rb"))
    for cookie in cookies:
        driver.add_cookie(cookie)
    
    bank_path = f"https://finbox.com/DSE:{text}"
    full_path = bank_path + "/financials/income_statement"
    
    print(driver.get(full_path)) // problem is here

    time.sleep(10)
    
    # print("Main content:", driver_data)
    
    
    # table = driver_data.find_element(By.CLASS_NAME, "rt-tbody")
    # table = driver_data.find_elements(By.CLASS_NAME, "rt-tbody")
    # table = driver_data.find(By.CLASS_NAME, "rt-tbody")
    # table = driver.find_elements_by_xpath('//*[@id="root"]/div/div[4]/div[3]/div[2]/div/div[1]/div[2]')
    # print("table len : ", len(table))
    # print("table type: ", type(table))
    # print("table content: ", table)

search("ABBANK")
1 Answers

driver.get() returns None. Always. It navigates to the specified URL but cannot be expected to return any value, as you've tried.

Related