0
<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>
我想單擊更多細節(它似乎是一個鏈接)。如何爲此找到Xpath?
我一直在使用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:XPath表達式 '// * [@的OnClick =' selectTab(2,11, 'MainTabControl','面板」,‘lblTitle’,‘paneltitle’,‘hfldSelectedTab’)‘]’無法評估或以WebElement(警告並notresult:服務器沒有提供任何堆棧跟蹤信息) 命令持續時間或超時:157毫秒
想了解更多詳細信息,它有8個選項,所有具有相同的ID和類值..它會工作嗎? – ChanGan
org.openqa.selenium.NoSuchElementException:無法找到xpath == // tr的元素[@ id ='MainTabControl2']/td [@ class ='TabCaption'](警告:服務器沒有提供任何堆棧跟蹤信息) 命令持續時間或超時:380毫秒 – ChanGan
@ChanGan請檢查我編輯的答案。請檢查您剛剛發佈的xpath –