python+appium
try:
if FindMethod == 'byid':
DriverIndex.find_element_by_id(Value)
elif FindMethod == 'byxpath':
DriverIndex.find_element_by_xpath(Value)
except NoSuchElementException as x:
总是报错,说NoSuchElementException 没有定义
NameError: global name 'NoSuchElementException' is not defined
但我find_element_by_id如果找不到的话,异常名明明是NoSuchElementException
...全文
3566打赏收藏
python+appium,用try语句总是报错,还请大神指点,谢谢
python+appium try: if FindMethod == 'byid': DriverIndex.find_element_by_id(Value) elif FindMethod == 'byxpath': DriverIndex.find_element_by_xpath(Value) except NoSuchElementException as x: 总是报错,说NoSuchElementException 没有定义 NameError: global name 'NoS