title: How to check if a selenium webelement has no sub tag in it which holds 'text'
body: <p>I have a web element that sometimes delay loading or do not load properly. But when it loads, it will have a number as text element. I need this text to check and do some process later. I am able to extract this text and convert as number when this webelement is loaded properly. When it loads, there will be a  tag element inside and it will consist a text as well. (Just for understanding what I am trying to explain, showing you an image of it. I have copy pasted code below) My aim is to extract this text '201515' below.</p>
  <p><a href="https://i.stack.imgur.com/U8YCp.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/U8YCp.jpg" alt="enter image description here" /></a></p>
  <p>There are series of elements and few are properly loaded and where as few are not. This is explained as:</p>
  <p><a href="https://i.stack.imgur.com/lYPRu.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lYPRu.jpg" alt="enter image description here" /></a></p>
  <p>But when the DOM does not load, the program just throws an error and my program aborts. Because it is not loaded properly, I will not have any anchor tag element and hence no text element item. Shown as below:</p>
  <p><a href="https://i.stack.imgur.com/VLdvO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VLdvO.jpg" alt="enter image description here" /></a></p>
  <p>At this time if I am checking as my <code>webelement.text</code>, it neither gives none or null value. Is there any possiblity how I can make it load properly or precisely check if there is no element text present, make it load and redo the operation. Or is my understanding wrong and it doesnot load ever at all?</p>
  <p>My python code:</p>
  <pre><code>for element_index in range(count_of_divs):
      index = str(element_index + 1)    # in web elements, it is one based index
      xpath = '//*[@id=&quot;wrapped_grid&quot;]/div[5]/div/div[' + index + ']/div[2]'
      test_id = WebDriverWait(self.login.driver, self.login.DELAY).until(
                              EC.presence_of_element_located((By.XPATH, xpath)))      
       # Get the Test ID number
      
      time.sleep(0.1)
      if test_id.text != &quot;&quot;:
         test_id_num = int(test_id.text)
         currentpage_test_ID_list.append(test_id_num
  </code></pre>
  <p>)</p>
  <p>This shows I have some discrepancy and text is blank. But how can I make this element load properly and get the text.</p>
  <p>Just for clear picture understanding, I am also adding screenshots of DOM. I copy pasted code above and it is not screenshot. Picture is only for understanding how it looks.</p>
  <p>I appreciate all your feedback/support in this</p>