2013-08-19 4 views
1

나는 셀레늄 IDE을 사용합니다. if-else 구조가 필요하며 Javascript 파일을 발견했습니다. 나는 IDE에서 파일을 쉽게 사용했다. (이 파일은 코어 -> 스크립트 -> 사용자 확장에Selenium user-extensions, Selenium IDE

  1. 개설 selenium.jar 파일 및 사용자 확장 파일을 변경 : 내가 셀레늄 RC와 파일을 사용하려고 할 때 그러나, 나는 단계를 따라) 인터넷에서 발견 한 것과 함께 (if-else 함수 포함).

-java -jar selenium.jar -userExtensions 사용자 extensions.js -htmlSuite "* 크롬" "linkofsite" "staj의 \ 프로젝트 :

  • 나는 명령으로 셀레늄 RC를 시작 4445

  • 셀레늄 서버 -port \ SikayetTestleri.html ""result2.html "나는 foun을했습니다 파이어 폭스 만의 속삭임에 앞으로 일어날 ...

    답변

    1

    시작 또 다른 방법은 내 problem.Instead 사용자 정의 확장을 해결하기 위해 storeEval 명령을 사용하고 자바 스크립트 코드의 2 줄을 썼다. 나는 조건문을 if 문 대신 사용했습니다.

    셀레늄 IDE 명령 :

    <tr> 
        <td>storeEval</td> 
        <td> 
         selenium.isElementPresent('Element I control')?selenium.doClick('Element which will be clicked if the element present'):seleniumdoClick('Element which will be clicked if the element NOT present') 
        </td> 
    </tr>