2015-01-08 1 views
2

간단한 테스트를 실행하여 아래 기능을 사용할 수 있는지 확인하려고합니다.saelcelabs에서 셀렌 테스트 실행 Windows7

java.lang.IllegalArgumentException: No enum constant org.openqa.selenium.Platform.Windows 7 
    at java.lang.Enum.valueOf(Enum.java:236) 
    at org.openqa.selenium.Platform.valueOf(Platform.java:30) 
    at org.openqa.selenium.remote.DesiredCapabilities.setCapability(DesiredCapabilities.java:168) 

내가 혼란 스러워요 :이 테스트를 실행하면 내가 윈도우 7을 사용할 수 없습니다처럼

import static org.junit.Assert.*; 

import java.net.URL; 

import org.junit.After; 
import org.junit.Before; 
import org.junit.Test; 

import org.openqa.selenium.WebDriver; 
import org.openqa.selenium.remote.DesiredCapabilities; 
import org.openqa.selenium.remote.RemoteWebDriver; 

public class Tests { 

    private WebDriver driver; 

    @Before 
    public void setUp() throws Exception { 
     // Choose the browser, version, and platform to test 
     DesiredCapabilities caps = DesiredCapabilities.firefox(); 
     caps.setCapability("platform", "Windows 7"); 
     caps.setCapability("version", "33"); 
     caps.setCapability("browserName", ""); 
     // Create the connection to Sauce Labs to run the tests 
     this.driver = new RemoteWebDriver(
       new URL("http://<axxxxxx>:<[email protected]:80/wd/hub"), 
       caps); 
    } 

    @Test 
    public void webDriver() throws Exception { 
     // Make the browser get the page and check its title 
     driver.get("http://www.amazon.com/"); 
     assertEquals("Amazon.com: Online Shopping for Electronics, Apparel, Computers, Books, DVDs & more", driver.getTitle()); 
    } 

    @After 
    public void tearDown() throws Exception { 
     driver.quit(); 
    } 
} 

, 그것은 같습니다

OS: Windows 7 
Browser: Firefox 
Browser Version: 33 

여기 내 코드입니다. 웹 사이트 http://docs.seleniumhq.org/about/platforms.jsp은 Windows 7이 지원된다고 말합니다. 내가 실수 한 부분이 어디 있니?

+0

setCapability에서'Platform.WINDOWS'로 시도해 볼 수 있습니까? –

+0

어떤 셀렌 버전을 사용하고 있습니까? Sauce Labs에서 지원하는 최신 버전 인 2.43.0을 사용하는 경우 작동합니까? – Louis

+0

VISTA로 플랫폼을 말할 필요가있는 것 같습니다. Windows7에서 실행 중입니다 .DesiredCapabilities capabilities = DesiredCapabilities.firefox(); capabilities.setCapability ("version", "33"); capabilities.setCapability ("platform", Platform.VISTA); capabilities.setCapability ("name", "Windows7Firefox33"); –

답변

1

다음과 같이 기능을 정의하면 내 문제가 해결됩니다. 플랫폼에서 VISTA를 관찰하십시오.

DesiredCapabilities capabilities = DesiredCapabilities.firefox(); 
capabilities.setCapability("version", "33"); 
capabilities.setCapability("platform", Platform.VISTA); 
capabilities.setCapability("name", "Windows7Firefox33"); 
2

당신은 셀레늄 2.44.0에 버그로 실행했습니다. 기사에 따르면

  1. 선호하는 옵션

    은 2.43.0로 되돌릴 경우 : 소스 연구소 기술 자료 this article에서 지적한 바와 같이, 두 가지 옵션이 있습니다.

  2. 선택한 옵션 : String이 아닌 Platform 열거 형의 값 중 하나를 사용하십시오. (그것은을 위해 적어도이이 옵션을 사용 할 수가 없었다 동안 밝혀하지만, 소스 랩의 사람들은 그것을 허용하는 최종 수정했습니다.)

이 기사는 지적이 셀레늄의 다음 버전 필요한 수정이있을 것입니다.

+0

Selenium 문제는 https://code.google.com/p/selenium/issues/detail?id=8083에 있습니다. –