def __init__(self, login_cookies): # get直接返回,不再等待界面加载完成 self.DBSession = getsession() desired_capabilities = DesiredCapabilities.CHROME desired_capabilities["pageLoadStrategy"] = "none" self.browser = chromeBrower().get_brower() self.browser.get('https://made-in-china.com/') self.main_handle = self.browser.current_window_handle self.browser.maximize_window() for cookie in login_cookies: self.browser.add_cookie(cookie)
def __init__(self, industry, login_cookies): self.industry = industry if industry.current_page_num is None or not industry.current_page_num: industry.current_page_num = 0 self.current_page_num = industry.current_page_num if industry.all_page_num is None or not industry.all_page_num: industry.all_page_num = 0 self.all_page_num = industry.all_page_num self.DBSession = getsession() self.browser = chromeBrower().get_brower() self.browser.get('https://made-in-china.com/') # self.browser.maximize_window() for cookie in login_cookies: self.browser.add_cookie(cookie) if industry.cus_list_link is not None: self.nextpage_link_template = industry.cus_list_link self.__get_nextpage_link() print(self.nextpage_link) self.browser.get(self.nextpage_link) else: print(industry.link) self.browser.get('https:' + industry.link) time.sleep(10)
def __init__(self): # 定义保存登录成功之后的cookie的变量 self.login_cookies = [] self.DBSession = getsession()