1 回答

TA貢獻(xiàn)2039條經(jīng)驗(yàn) 獲得超8個(gè)贊
您找不到標(biāo)題,因?yàn)槟鷱?resultsCol 中獲取了所有的 div。這意味著有些 div 有標(biāo)題,有些則沒有。
嘗試這個(gè) :
try:
td = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.ID, "resultsCol"))
)
divs = td.find_elements_by_tag_name("div")
#print(divs)
for div in divs:
try:
header = div.find_element_by_class_name("title")
print(header.text)
except:
continue
finally:
driver.quit()
driver.quit()
將標(biāo)題作為輸出:
Receptionist
Administrative Assistant/ Document Controller
RECEPTIONIST
ADMIN OFFICER IN UAE
Data Entry Assistant (Fresh Graduate)
Receptionist
Replenishment Associate - Light Household - Hypermarket
DOCUMENT CONTROLLER
School Administrative Assistant - Dubai
ACCOUNTANT
添加回答
舉報(bào)