NoSuchElementException
не является частью webdriver
, он является частью selenium.common.exceptions
try:
strValue = strValue + ',' + browser.find_element_by_css_selector('#visKTTabset > div.h-tab-content > div.h-tab-content-inner > div:nth-child(12) > table > tbody > tr.stripes-even > td:nth-child(3) > span').text
except NoSuchElementException: # without webdriver.
StrValue = strValue + ',' + "Status not found"
И убедитесь, что strValue
объявлен перед блоком try except
.
Как примечание стороны, в Python strValue
должно быть str_value