2013-03-07 113 views
0

當我錄製我的腳本時,當它到達點擊「添加評論」圖標的部分時,我的scrpit失敗。我得到的錯誤是找不到該元素。在HTML腳本是:單擊「添加評論」按鈕

一個ID = 「cmt_place」 級= 「BTN add_comment」 的onclick = 「JavaScript的:SNI.Community.Toolbox.TopNavCheckandShow()」>

所以我很困惑該命令我應該使用以及目標和價值應該如何,以便在測試運行時它應該能夠自動點擊添加評論圖標。

新建測試用例

open /registration/login.esi  
type id=up-ur-email    
type id=up-ur-password  

click css=#up-ur-widget-login > #up-ur-widget-nav-item-off > a > em 
open /home/home.esi 
click link=TEST_upload  
click id=Add Comment 
click id=commenttext 
type id=commenttext    test123 
click css=#post-comment-omnt > em  
clickAndWait link=Log Out  

回答

0
open /registration/login.esi  
type id=up-ur-email    
type id=up-ur-password  

click css=#up-ur-widget-login > #up-ur-widget-nav-item-off > a > em 
open /home/home.esi 
click link=TEST_upload 
Pause 30000 
click id=Add Comment 
click id=commenttext 
type id=commenttext    test123 
click css=#post-comment-omnt > em  
clickAndWait link=Log Out  


pause command will pause 3 second before click the Add comment button. 

Try this. 

Thank you. 
0

使用評論框的XPath目標字段,並使用暫停& setCursorPosition命令 暫停等待一段時間,setCursorPosition命令,使其指向評論框

open /registration/login.esi  
type id=up-ur-email    
type id=up-ur-password  
click css=#up-ur-widget-login > #up-ur-widget-nav-item-off > a > em 
open /home/home.esi 
click link=TEST_upload 
click id=Add Comment(use Xpath of comment box instead of this) 
pause 2000 
setCursorPosition id=commenttext 
click id=commenttext 
type id=commenttext    test123 
click css=#post-comment-omnt > em  
clickAndWait link=Log Out