![](/img/trans.png)
[英]Python Selenium PhantomJS not clicking on same button that Firefox Webdriver is able to click
[英]Not able to click or Expand the + image button in python selenium webdriver
我正在嘗試擴展+按鈕以擴展其下的選項,但無法擴展並且python IDE拋出以下錯誤。 嘗試了不同的CSS和Xpath,但是沒有運氣:(
錯誤信息:
selenium.common.exceptions.NoSuchElementException:消息:沒有這樣的元素:無法找到元素:{“ method”:“ xpath”,
Firefox XPath:
.//*[@id='ExcentiveTreeViewn0']/img
下面的html代碼:
<table cellspacing="0" cellpadding="0" style="border-width:0;">
<tbody>
<tr>
<td>
<a id="ExcentiveTreeViewn0" href="javascript:TreeView_PopulateNode(ExcentiveTreeView_Data,0,document.getElementById('ExcentiveTreeViewn0'),document.getElementById('ExcentiveTreeViewt0'),null,'r','<span class=\'nodeCss\' onclick=\"LoadPage(\'grids%252fgrid_folders.aspx%253fid_node%253dTzlq3UXxbAE%253d%2526id_table%253d-301%2526id_mod%253dTzlq3UXxbAE%253d\', \'iGrid\');\"><img class=\'nodeIcon\' src=\"../style/-1/treeview/picto_folder.gif\" /><span class=\'nodeText\'>Rules</span></span>','-300#-301#0#staticNode#0#culture#F','f','','f')">
<img style="border-width:0;" alt="Develop" src="../style/-1/treeview/rplus.gif"/>
</a>
</td>
<td class="" style="white-space:nowrap;" onmouseout="TreeView_UnhoverNode(this)" onmouseover="TreeView_HoverNode(ExcentiveTreeView_Data, this)">
</tr>
</tbody>
</table>
不要以句號開始xpath
//a[@id='ExcentiveTreeViewn0']/img
其他選項:
請編輯問題,以包括您嘗試的代碼以及HTML的較大部分
路由到正確的IFrame並使用以下鏈接中所述的操作類后,問題已解決
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.