Here is my code
src = driver.page_source
XPATHLoop=['//*[@id="General"]/fieldset/dl/dd[15]', '//*[@id="General"]/fieldset/dl/dd[14]', '//*[@id="General"]/fieldset/dl/dd[13]','//*[@id="General"]/fieldset/dl/dd[12]']
for d in XPATHLoop:
Checkpath = re.search(d,src)
if Checkpath =='//*[@id="General"]/fieldset/dl/dd[15]':
Status= driver.find_element_by_xpath('//*[@id="General"]/fieldset/dl/dd[8]').text
break
elif Checkpath == '//*[@id="General"]/fieldset/dl/dd[14]':
Status= driver.find_element_by_xpath('//*[@id="General"]/fieldset/dl/dd[7]').text
break
elif Checkpath == '//*[@id="General"]/fieldset/dl/dd[13]':
Status = driver.find_element_by_xpath('//*[@id="General"]/fieldset/dl/dd[6]').text
break
elif Checkpath == '//*[@id="General"]/fieldset/dl/dd[12]':
Status= driver.find_element_by_xpath('//*[@id="General"]/fieldset/dl/dd[5]').text
break
else:
Status= "NULL"
print(Status)
Output is 'NULL' meaning that it isn't finding anything, while these paths do/can exist in the source. I am currently using selenium and regex. I'm currently thinking that there may be another method in regex to pull the xpaths.
xmlfrom the standard lib docs.python.org/3/library/…