samedi 24 avril 2021

"if else not working for selenium python in find_elements_by_xpath"

for each_job in job_list: job_company = each_job.find_elements_by_xpath(".//span[@class='company']")[0] job_location = each_job.find_elements_by_xpath(".//span[@class='location accessible-contrast-color-location']")[0]

if each_job.find_elements_by_xpath(".//div[@class='salaryText']").is_displayed():
    job_salary = each_job.find_elements_by_xpath(".//div[@class='salaryText']")[0]
else:
    job_salary = "Not Mentioned"
    
job_summary = each_job.find_elements_by_xpath(".//div[@class='summary']")[0]

Aucun commentaire:

Enregistrer un commentaire