2014-03-13 50 views
0

我想在eclipse中使用Perfectomobile在手機上測試網站。運行代碼時出現初始化錯誤。這看起來像一個http請求錯誤。我想知道是否有代理我可以嘗試與日食。我可以直接在我的瀏覽器上訪問此網址。Perfectomobile初始化錯誤

這裏是初始化

public class MobileTest { 

    public static void main(String[] args) { 
     String deviceID = "1F297702"; 
     \\Initializing 
     MobileDriver driver = new MobileDriver(); 

     try { 
      //code area 
      driver.getDevice(deviceID); 

      sleep(13000); 
      MobileDeviceOpenOptions open = new MobileDeviceOpenOptions(); 
      driver.getDevice(deviceID).open(open); 

和錯誤控制檯代碼

Error: 
Run started 
Starting Mobile Driver 
12:16:55.103 [main] INFO c.p.selenium.MobileDriver - Creating mobile driver 
12:16:55.109 [main] INFO c.p.selenium.MobileDriver - Starting execution 
12:16:55.142 [main] INFO c.p.httpclient.HttpClient - Processing request Request[_requestType=START_EXECUTION,_itemId=<null>,_parameters=[ParameterValue[_name=responseFormat,_value=xml]],_stringParameters=<null>,_encoding=<null>] 

Exception in thread "main" java.lang.RuntimeException: Failed to start play 
    at com.perfectomobile.selenium.MobileDriver.initWithEclipseParams(MobileDriver.java:86) 
    at com.perfectomobile.selenium.MobileDriver.<init>(MobileDriver.java:39) 
    at MobileTest.main(MobileTest.java:41) 

Caused by: com.perfectomobile.httpclient.HttpClientException: Error while processing HTTP request for URL in https & username & password 
    at com.perfectomobile.httpclient.HttpClient.sendTextRequest(HttpClient.java:195) 
    at com.perfectomobile.httpclient.HttpClient.sendTextRequest(HttpClient.java:143) 
    at com.perfectomobile.httpclient.HttpClient.sendValuesRequest(HttpClient.java:56) 
    at com.perfectomobile.httpclient.execution.ExecutionsHttpClient.startPlay(ExecutionsHttpClient.java:217) 
    at com.perfectomobile.selenium.MobileDriver.initWithEclipseParams(MobileDriver.java:76) 

回答

1

是 - PERFECTO移動支持代理

見附件代碼:

// Setting up the proxy 
      MobileProxy proxy = new MobileProxy("name", 
         8080, "XXX "XXX"); 
      DesiredCapabilities capabilities = new DesiredCapabilities(); 
      capabilities.setCapability(CapabilityType.PROXY, proxy); 
      MobileDriver connector = new MobileDriver(capabilities); 
      System.out.println("Script started"); 

莫重新代碼示例您可以去: https://github.com/perfectomobile/examples

+0

user @ 3423363,這是我正在尋找的。謝謝。 – SamK