I have a submenu item that I used to be able to access via selenium web navigation. Now I keep getting the following error: "You may only interact with visible elements". I have tried a number of recommendations (waits, implicit/explicit, maximizing windows, using the ActionChain object) without success. Can anyone spot why this element would remain invisible by looking at the following HTML and code?:
<ul class="nav" >
<li>
<a href="/edc">EDC</a>
</li>
</ul>
<ul class="nav" >
<li>
<a href="/qa/main">Queries</a>
</li>
</ul>
<ul class="nav" >
<li>
<a href="/docs">Docs</a>
</li>
</ul>
<ul class="nav" >
<li>
<a href="/data">Data</a>
</li>
</ul>
<ul class="nav" >
<li>
<a href="/aal/main">Audit Log</a>
</li>
</ul>
<ul class="nav" >
<li>
<a href="/summaries/main">Reports</a>
</li>
</ul>
<ul class="nav" >
<li class="dropdown ">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tools <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>
<a href="/sql">SQL Worksheet</a>
</li>
<li>
<a href="/meddra">Meddra</a>
</li>
<li>
<a href="/sae">SAE</a>
</li>
<li>
<a href="/pdf">Worksheets</a>
</li>
<li>
<a href="/pipelines/report">Pipelines</a>
</li>
<li>
<a href="/tools/sync">Sync</a>
</li>
<li>
<a href="/db">Project Management</a>
</li>
<li>
<a href="/rss">RSS</a>
</li>
<li>
<a href="/ipt/main">IPT</a>
</li>
<li>
<a href="/images/main">Images</a>
</li>
</ul>
</li>
</ul>
And here is the python code snippet that is not working:
try:
menu_item = driver.find_element(By.LINK_TEXT, 'Tools')
actions = ActionChains(driver)
actions.click(menu_item).perform()
except Exception as error:
print ("Tools menu not found: " + str(error))
try:
wait = WebDriverWait(driver, 10) wait.until(EC.presence_of_element_located(By.XPATH("/html/body/header/div/div/div/div/ul[7]/li/ul/li[9]/a")));
ipt_menu_item = driver.find_element(By.XPATH, "/html/body/header/div/div/div/div/ul[7]/li/ul/li[9]/a")
actions.click(ipt_menu_item).perform()
except Exception as error:
print ("Tools | IPT link not found: " + str(error))