xpath - Not able to hit the image element which works as a button in ui? -
i newbee selenium webdriver using python below configuration:
selenium webdriver: selenium-2.40.0(python bindings) python version : python 2.7 os : windows
i have tried hitting mentioned control through xpath , css selector in script unable hit control.i crosschecked in xpath viewer xpath, showing there .i tried hit control css selector not hitting it.i able access other controls there on webpage using css
selector , xpath
.i have attached html
code xpath , css selector syntax using in code.
the xpath using script : find_element_by_xpath("//img[@title='expand all' , @alt='expand all']")
the css selector using in script : find_element_by_css_selector("a[class='lnk1'][onclick*='treetable(expandall)']")
<table width="" cellspacing="0" cellpadding="0" border="0" role="presentation"> <tbody> <tr> <td width=""> <a class="lnk1" onfocus="" onclick="this.style.cursor='wait';document.body.style.cursor='wait'; return dotblajax('wtableform_453ea28b', 'action_453ea28b', 'treetable(expandall)', 'tabletop_453ea28b', 'action_453ea28b', 'wh', 'wa', event);" onblur="" href="/hmc/bonsai/action/t56?wh=action_453ea28b&action_453ea28b=treetable%28expandall%29×tamp=144e404faf0#tabletop_453ea28b"> <img class="tbl9" width="32" border="0" align="top" height="32" title="expand all" src="/wclres/wcl/images/tretbl1.gif" role="button" onmouseover="classname='tbl10'" onmouseout="classname='tbl9'" alt="expand all"> </a>
try css selector
the safe method css=div.someclass'] a[contains(@onclick,'treetable(expandall)')] > img
this serving unique xpath expand button.
thanks!
Comments
Post a Comment