1. po的改造
https://github.com/yuruotong1/lagou-1
2. 显式等待
wait_for 逻辑
#显式等待
def wait_for(self, fun):
# 如果fun返回了true,那么就退出显式等待
WebDriverWait(self._driver, 10).until(fun)
wait逻辑
def wait(driver):
ele_len = len(self.finds(By.ID, "username"))
if ele_len < 1:
self.find(By.CSS_SELECTOR, ".js_has_member>div:nth-child(1) .js_add_member").click()
# 如果username存在,就返回true
return ele_len >= 1