0
votes

I'm trying to expand the + button to expand the option under it but unable to expand and python IDE throws below error. Tried different CSS and Xpaths but no luck :(

Error message:

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath",

Firefox XPath:

.//*[@id='ExcentiveTreeViewn0']/img

html code below:

<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>
2
Can you provide the url? - G_M
Also, can you share the code snippet around the point where this exception occurs? - Ian Lesperance
I'm very sorry,site URL will not be able to access to the members outside of my organization - Abhishek s
@Ian Scenario is, I'm logging into the website and in the home page the + button is available to expand the tree.The URL of the site will not be able to access outside of Org and i'll not be able to give you the site URL or the snippet which you asked as the above code would be of opening the website which contains site URL.Thanks - Abhishek s
Then remove/obscure the URL from the snippet. Without more information, we can’t help debug your problem. - Ian Lesperance

2 Answers

0
votes

Don't start the xpath with a period

//a[@id='ExcentiveTreeViewn0']/img

Other options:

  1. The code is inside an iFrame so you would need to switch to it first.
  2. The javascript in the href is confusing the selenium parser. There is a lot of HTML code embedded in there.

Please edit the question to include the code you are trying along with a larger section of the HTML

0
votes

Issue was Resolved After routing to correct IFrame and using action class as mentioned in the below link

Link: Unable to perform click action in selenium python