您的位置:軟件測(cè)試 > 開源軟件測(cè)試 > 開源測(cè)試管理工具 > Testlink
Testlink定位實(shí)例
作者:網(wǎng)絡(luò)轉(zhuǎn)載 發(fā)布時(shí)間:[ 2015/12/31 13:17:55 ] 推薦標(biāo)簽:測(cè)試管理工具 軟件測(cè)試工具

  近在對(duì)testlink系統(tǒng)上做點(diǎn)東西,在定位部分元素時(shí)折騰了一段時(shí)間才搞定,特此記錄
  如下圖

  要定位紅色框部分
  一:先分析testlink頁面結(jié)構(gòu),如下
  如二個(gè)frame組成,一個(gè)是titlebar另一個(gè)是主frame,所以在定位時(shí)必須切換才能定位到相關(guān)元素
<frameset rows="70,*" frameborder="0" framespacing="0">
<frame src="lib/general/navBar.php?tproject_id=0&tplan_id=0&updateMainPage=1" name="titlebar" scrolling="no" noresize="noresize" />
<frame src="lib/general/mainPage.php" scrolling='auto' name='mainframe' />
<noframes>
<body>TestLink required a frames supporting browser.</body>
</noframes>
</frameset>
  二、定位測(cè)試產(chǎn)品并選擇對(duì)應(yīng)產(chǎn)品內(nèi)容:

browser.switch_to_frame('titlebar')  #切換到iframe為titlebar上
print browser.current_url
#browser.find_element_by_name('testproject').click()
#遍歷下拉框并選擇需要的項(xiàng)目
select = browser.find_element_by_name("testproject")
allOptions = select.find_elements_by_tag_name("option")
for option in allOptions:
print "Value is: " + option.get_attribute("value")
print "Text is:" +option.text
if testconfig['testprojectid'] in option.text:
option.click()
break
time.sleep(1)
browser.find_element_by_xpath("//img[@title='執(zhí)行']").click() #執(zhí)行用例

上一頁12下一頁
軟件測(cè)試工具 | 聯(lián)系我們 | 投訴建議 | 誠(chéng)聘英才 | 申請(qǐng)使用列表 | 網(wǎng)站地圖
滬ICP備07036474 2003-2017 版權(quán)所有 上海澤眾軟件科技有限公司 Shanghai ZeZhong Software Co.,Ltd