我在eclipse中使用了selenium rc和testNG。我需要點擊文字鏈接。這是我的頁面的源代碼:點擊文本鏈接selenium rc
<script type="text/javascript">
dmenu = new dTree('dmenu');
dmenu.add(0,-1,'');
dmenu.add(1,0,'<b>World</b>','','');
...
在開發工具的代碼如下所示:
<link type="text/css" href="../css/dtree.css" rel="StyleSheet"/>
<script src="../script/dtree.js" type="text/javascript"/>
<div class="dtree">
<script type="text/javascript"> dmenu = new dTree('dmenu'); dmenu.add(0,-1,''); dmenu.add(1,0,'<b>World</b>','',''); ................
<div class="dtree">
<div id="ddmenu0" class="clip" style="display:block;">
<div class="dTreeNode">
<a class="node" href="javascript: dmenu.o(1);">
<b>World</b>
</a>
我嘗試成才這樣selenium.click("xpath=//b[contains(text(),'World')]");
,但得到elememt未發現的錯誤。任何人都可以幫忙嗎?
嘗試'selenium.click(「css = b」);' –