title: Python Selenium : NoSuchElementException: Message: no such element: Unable to locate element
body: <p>I am new to HTML and Selenium, and I have struggling with the following error:</p>
  <p><em>raise exception_class(message, screen, stacktrace)
  selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {&quot;method&quot;:&quot;xpath&quot;,&quot;selector&quot;:&quot;//</em>[contains(text(),'Manage Users')]&quot;}*</p>
  <p>I have tried a wide array of various combinations of attributes, and to no avail. I can't directly use the ID of the element because it is dynamic. The code below is a fraction of the combinations that I have tried:</p>
  <pre><code>from selenium import webdriver
  from selenium.webdriver.common.keys import Keys
  from selenium.webdriver.common.by import By
  from selenium.webdriver.support.ui import WebDriverWait
  from selenium.webdriver.support import expected_conditions as EC
  import time
  
  driver = webdriver.Chrome()
  driver.get('url')
  
  driver.find_element_by_id('j_username').send_keys('my_username')
  driver.find_element_by_id('j_password').send_keys('my_password')
  driver.find_element_by_id('button.ok').click()
  
  time.sleep(3)
  
  driver.switch_to.frame('portfolio_canvas_area')
  driver.switch_to.frame('portfolio_area')
  
  time.sleep(5)
  
  #driver.find_element_by_xpath(&quot;/html/body/div/div/form/span/span[1]/span/div/div/table[2]/tbody/tr[3]/td/table/tbody/tr/td[2]/span/span/a&quot;)
  driver.find_element_by_xpath(&quot;//*[contains(text(),'Manage Users')]&quot;)
  #WebDriverWait(driver,20).until(EC.element_to_be_clickable((By.XPATH,'/html/body/div/div/form/span/span[1]/span/div/div/table[2]/tbody/tr[3]/td/table/tbody/tr/td[2]/span/span/a'))).click()
  #WebDriverWait(driver,10).until(EC.element_to_be_clickable((By.XPATH,'//span[text()=&quot;Manage Users&quot;]'))).click()
  </code></pre>
  <p>The following is the HTML in question giving me issues:</p>
  <pre><code>&lt;a href=&quot;javascript:action('https://website.com/itim/console/action/Te502a9571b590da5d71c7#W5f82fbdc1b590c3ea782a_treeSel(3)')&quot; id=&quot;W5f82fbdc1b590c3ea782a_treeSel(3)&quot; name=&quot;W5f82fbdc1b590c3ea782a_treeSel(3)&quot; onclick=&quot;if (confirmPageChange()) {saveTaskFormElements();return doSubmit('form', 'W5f82fbdc1b590c3ea782a_treeSel', 'treeSel(3)', 'W5f82fbdc1b590c3ea782a_treeSel(3)', 'treeFunc', 'wh', 'wa'); }&quot; style=&quot;color:#000000;font-size:83.3%;font-family:Arial, Helvetica, sans-serif;&quot; taskid=&quot;MANAGE_USERS&quot; title=&quot;Manage Users&quot;&gt;Manage Users&lt;/a&gt;
  </code></pre>
  <p>I have also attached some pictures of parent HTML code from Chrome's Inspector with this question. I would greatly appreciate your help in relieving some of the headaches that this has caused! Thank you!</p>
  <p><a href="https://i.stack.imgur.com/SFmGc.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SFmGc.jpg" alt="enter image description here" /></a>
  <a href="https://i.stack.imgur.com/iPFyw.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iPFyw.jpg" alt="enter image description here" /></a>
  The following picture shows the webpage, where buttons on the left frame opens up a new tab displayed on the right frame.
  <a href="https://i.stack.imgur.com/drDir.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/drDir.jpg" alt="enter image description here" /></a></p>