연결 거부 Ubuntu 9.04를 통해 Selenium Grid 1.04에서 여러 환경 실행을 거부했습니다.
-
18-09-2019 - |
문제
일련의 다른 기계에서 실행될 셀레늄 그리드 테스트 스위트를 작성하고 있습니다. 나는 MacBook에 대부분을 썼지 만 최근 Ubuntu 9.04를 실행하는 작업 기계로 전송했습니다. 그것은 실제로 Linux 시스템에 대한 첫 경험이므로 매우 간단한 것을 놓치고있을 수 있습니다 (방화벽을 비활성화했습니다).
나는 다중 환경 일을 전혀 작동시킬 수 없었고, 한동안 노력하고 수동으로 검토를 해왔습니다. 모든 권장 사항과 도움이 크게 감사하겠습니다!
테스트를 실행할 때 얻는 오류는 다음과 같습니다.
Java] 구성 실패 : @beforemethod StartFirstenVironment ( "LocalHost", 4444, "*Safari", "http : // remoteurl : 8080/튜터") [Java] java.lang.runtimeexception : 셀레늄 세션을 시작할 수 없음 : 오류 : 연결 거부
연결을 거부하는 Mac일지도 모르지만 Wireshark를 사용하여 Mac에서는 연결 시도가 없다고 결정했습니다. 다음은 세션을 설정하기위한 코드입니다. 세션은 죽어가는 것 같습니다.
@BeforeMethod(groups = {"default", "example"}, alwaysRun = true)
@Parameters({"seleniumHost", "seleniumPort", "firstEnvironment", "webSite"})
protected void startFirstEnvironment(String seleniumHost, int seleniumPort, String firstEnvironment, String webSite) throws Exception {
try{
startSeleniumSession(seleniumHost, seleniumPort, firstEnvironment, webSite);
session().setTimeout(TIMEOUT);
} finally {
closeSeleniumSession();
}
}
@BeforeMethod(groups = {"default", "example"}, alwaysRun = true)
@Parameters({"seleniumHost", "seleniumPort", "secondEnvironment", "webSite"})
protected void startSecondEnvironment(String seleniumHost, int seleniumPort, String secondEnvironment, String webSite) throws Exception {
try{
startSeleniumSession(seleniumHost, seleniumPort, secondEnvironment, webSite);
session().setTimeout(TIMEOUT);
} finally {
closeSeleniumSession();
}
}
그리고 테스트를 실행하는 데 사용되는 동반 빌드 스크립트
<target name="runMulti" depends="compile" description="Run Selenium tests in parallel (20 threads)">
<echo>${seleniumHost}</echo>
<java classpathref="runtime.classpath"
classname="org.testng.TestNG"
failonerror="true">
<sysproperty key="java.security.policy" file="${rootdir}/lib/testng.policy"/>
<sysproperty key="webSite" value="${webSite}" />
<sysproperty key="seleniumHost" value="${seleniumHost}" />
<sysproperty key="seleniumPort" value="${seleniumPort}" />
<sysproperty key="firstEnvironment" value="${firstEnvironment}" />
<sysproperty key="secondEnvironment" value="${secondEnvironment}" />
<arg value="-d" />
<arg value="${basedir}/target/reports" />
<arg value="-suitename" />
<arg value="Selenium Grid Java Sample Test Suite" />
<arg value="-parallel"/>
<arg value="methods"/>
<arg value="-threadcount"/>
<arg value="15"/>
<arg value="testng.xml"/>
</java>
해결책
그래, 나는 바보 같은 느낌이 든다. 상당한 피들링 후 빌드 파일의 Seleniumhost 속성을 Selenium-RC 인스턴스를 실행하는 기계의 IP로 변경한다는 것을 깨달았습니다. 로컬 호스트로 사용하는 것은 단지 루프를 만들었습니다.
제휴하지 않습니다 StackOverflow