问题描述:
2021年7月28日17:34:5
添加了一个阻塞线程之后,以回到了原点:
代码以如下:
# -*- coding=utf-8 -*-
import threading
import time
import unittest
from selenium import webdriver
'''
腾讯职位的前 10 位数据, 并写入 excel, 每页有 10 条信息
https://careers.tencent.com/search.html?query=co_1&sc=1
(https://careers.tencent.com/search.html?query=co_1&index=1&sc=1)
https://careers.tencent.com/search.html?query=co_1&index=2&sc=1
https://careers.tencent.com/search.html?query=co_1&index=3&sc=1 # 第一页的 URL
'''
class Tencent(unittest.TestCase):
def setUp(self): # 初始化方法
self.driver = webdriver.Chrome(executable_path="D:\Python_module\chromdriver\chromedriver.exe")
self.driver.maximize_window()
def testTencent(self): # 测试方法 ,test 开头
# self.driver.get("https://www.baidu.com")
# for i in range(1, 3):
# threading.Thread(target=self.crawl(i), name="线程" + str(i)).start()
# threading.Thread(target=self.crawl(i), name="线程" + str(i)).join()
threading.Thread(target=self.crawl(1), name="线程" + str(1)).start()