2016-11-25 1 views

답변

0

storeEval 여기에 도움이 될 수 있습니다! 셀렌 IDE에서 이것을 소스 코드로 실행하십시오.

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
<head profile="http://selenium-ide.openqa.org/profiles/test-case"> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
<link rel="selenium.base" href="http://192.168.0.118:8080" /> 
<title>New Test</title> 
</head> 
<body> 
<table cellpadding="1" cellspacing="1" border="1"> 
<thead> 
<tr><td rowspan="1" colspan="3">New Test</td></tr> 
</thead><tbody> 
<tr> 
    <td>storeEval</td> 
    <td>{new Date()}</td> 
    <td>Cur_time</td> 
</tr> 
<tr> 
    <td>echo</td> 
    <td>${Cur_time}</td> 
    <td></td> 
</tr> 
<tr> 
    <td>pause</td> 
    <td>5000</td> 
    <td></td> 
</tr> 
<tr> 
    <td>storeEval</td> 
    <td>{new Date()}</td> 
    <td>Cur_time2</td> 
</tr> 
<tr> 
    <td>echo</td> 
    <td>${Cur_time2}</td> 
    <td></td> 
</tr> 
<tr> 
    <td>storeEval</td> 
    <td>{(storedVars[&quot;Cur_time2&quot;].getTime() - storedVars[&quot;Cur_time&quot;].getTime())/1000}</td> 
    <td>diff</td> 
</tr> 
<tr> 
    <td>echo</td> 
    <td>${diff}</td> 
    <td></td> 
</tr> 
</tbody></table> 
</body> 
</html> 

당신은 다음과 같은 출력을 얻을해야합니다

[info] Playing test case Untitled 
[info] Executing: |storeEval | {new Date()} | Cur_time | 
[info] script is: {new Date()} 
[info] Executing: |echo | ${Cur_time} | | 
[info] echo: Fri Nov 25 2016 14:27:37 GMT+0530 (India Standard Time) 
[info] Executing: |pause | 5000 | | 
[info] Executing: |storeEval | {new Date()} | Cur_time2 | 
[info] script is: {new Date()} 
[info] Executing: |echo | ${Cur_time2} | | 
[info] echo: Fri Nov 25 2016 14:27:43 GMT+0530 (India Standard Time) 
[info] Executing: |storeEval | {(storedVars["Cur_time2"].getTime() - storedVars["Cur_time"].getTime())/1000} | diff | 
[info] script is: {(storedVars["Cur_time2"].getTime() - storedVars["Cur_time"].getTime())/1000} 
[info] Executing: |echo | ${diff} | | 
[info] echo: 5.06 
[info] Test case passed 
[info] Test suite completed: 1 played, all passed! 

[정보] 에코 : 5.06는 테스트 시간은 5.06 초였다 의미한다. 시작 시간과 종료 시간을 캡처하려면 Cur_timeCur_time2에 대한 두 storeEval 호출간에 전체 테스트를 배치해야합니다. 희망이 도움이!

+1

Abhinav Singh님께 고마워요. –

+0

도움이 되셨다면 기꺼이 도와 드리겠습니다! 이 게시물을 통해 이동하십시오 : http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work –

관련 문제