【发布时间】:2015-04-29 06:44:26
【问题描述】:
<table cellspacing="0" cellpadding="0" width="50" border="0" style="border-collapse:collapse;">
<tr class="TabUnselected" valign="top" id="MainTabControl2">
<td width="5"><img width="5" height="5" border="0" src="images\eyebrow-upper-left-corner.gif" style="border-width:0px;" /></td><td><table cellspacing="3" cellpadding="0" width="99%" border="0">
<tr>
<td class="TabCaption" align="left" valign="bottom" OnClick="selectTab(2, 11, 'MainTabControl', 'Panel', 'lblTitle', 'paneltitle', 'hfldSelectedTab');" OnMouseOver="highlightTab('MainTabControl2', 'TabUnselected', 'TabHighlighted');" OnMouseOut="resetTab('MainTabControl2', 'TabUnselected', 'TabHighlighted');" style="white-space:nowrap;">**More Details**</td></tr>
</table>
我想点击更多详细信息(它似乎是一个链接)。
我尝试过使用 linkText 但返回异常..
Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to find element with link text == More Details (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 421 milliseconds
无论如何..如何识别xpath?
//*[@OnClick='selectTab(2, 11, 'MainTabControl', 'Panel', 'lblTitle', 'paneltitle', 'hfldSelectedTab')']
通过给 xpath 尝试这种方式.. 没有运气.. org.openqa.selenium.InvalidSelectorException: The xpath expression '//*[@OnClick='selectTab(2, 11, 'MainTabControl', 'Panel', ' lblTitle', 'paneltitle', 'hfldSelectedTab')'] ' 无法评估或不会产生 WebElement(警告:服务器未提供任何堆栈跟踪信息) 命令持续时间或超时:157 毫秒
【问题讨论】: