from fund.src.Info import Info # 测试start_driver,成功启动driver,则打印成功启动 def start_driver_test(info): driver = info.start_driver() print("Start driver successfully") return driver if __name__ == "__main__": file = r"C:\Libao\Test\fund\data\new_mix_url.txt" info = Info(file) start_driver_test(info)
def get_url_test(file): info = Info(file) url_list = info.get_url() print(url_list)
from fund.src.Info import Info def save_page_source_test(info, page_source): info.save_page_source(page_source) if __name__ == "__main__": file = r"C:\Libao\Test\fund\data\new_mix_url.txt" info = Info(file) with open("../data/new_mix_url.txt", "r") as f: url = f.readline() driver = info.start_driver() page_source = info.get_page_source(url, driver) save_page_source_test(info, page_source)
from fund.src.Info import Info # 测试get_page_source,启动driver,获取源码,打印源码 def get_page_source_test(info, url, driver): page_source = info.get_page_source(url, driver) print(page_source) if __name__ == "__main__": file = r"C:\Libao\Test\fund\data\new_mix_url.txt" info = Info(file) with open("../data/new_mix_url.txt", "r") as f: url = f.readline() driver = info.start_driver() get_page_source_test(info, url, driver)
from fund.src.Info import Info def get_table_info_test(info, boxes): info.get_table_info(boxes) if __name__ == "__main__": file = r"C:\Libao\Test\fund\data\new_mix_url.txt" info = Info(file) source_file = open("../results/test3.html", "r", encoding="utf-8") soup = info.get_soup(source_file) boxes = info.get_box(soup) get_table_info_test(info, boxes)
from fund.src.Info import Info def get_box_test(info, soup): boxes = info.get_box(soup) print(boxes) print(len(boxes)) if __name__ == "__main__": file = r"C:\Libao\Test\fund\data\new_mix_url.txt" info = Info(file) source_file = open("../results/test3.html", "r", encoding="utf-8") soup = info.get_soup(source_file) get_box_test(info, soup)