2015-02-23 67 views
0

根據文檔,我看到SelendroidDriver需要傳遞兩個參數。我不確定我是否感到困惑,但編輯根本不允許我只添加 driver = new SelendroidDriver(capa); 當我鼠標懸停時的代碼,我看到這條消息, 「構造SelendroidDriver(SelendroidCapabilities)是未定義 1修復可用 添加參數匹配」 SelendroidDriver(URL,能力)SelendroidDriver構造函數是否需要傳遞兩個參數?網址和功能?

可有人請澄清?

http://mavenbrowse.pauldoo.com/central/io/selendroid/selendroid-client/0.10.0/selendroid-client-0.10.0-javadoc.jar/-/io/selendroid/SelendroidDriver.html

檢查在上述鏈路的構造方法摘要部分。 SelendroidDriver類可以有兩個參數。我現在完全困惑! 構造方法摘要 SelendroidDriver(org.openqa.selenium.Capabilities帽) SelendroidDriver(URL網址,org.openqa.selenium.Capabilities帽)

這裏是我完整的代碼,

import java.util.concurrent.TimeUnit; 
import junit.framework.Assert; 
import io.selendroid.SelendroidDriver; 
import io.selendroid.common.SelendroidCapabilities; 
import org.openqa.selenium.By; 
import org.openqa.selenium.WebDriver; 
import org.openqa.selenium.WebElement; 

public class TestClass1 { 


public static void main(String[] args) throws Exception{ 

try{ 

    SelendroidCapabilities capa = new SelendroidCapabilities("io.selendroid.testapp:0.14.0"); 

    WebDriver driver = new SelendroidDriver("http://localhost:4444/wd/hub/status", capa); 
    WebElement inputField = driver.findElement(By.id("my_text_field")); 
    inputField.sendKeys("Selendroid"); 
    driver.quit(); 
} 

catch(Exception E) 

{ 
    throw E; 
} 

} 
} 
+0

請檢查您正在使用的Selendroid的版本。最新的是0.14.0。 – 2015-02-23 10:43:48

+0

@VivekSingh是的,我正在使用最新版本 – Sandeep 2015-02-23 11:05:16

回答

0

似乎有沒有構造函數:

SelendroidDriver(String url, org.openqa.selenium.Capabilities caps) 

所以可能你想做的事:

WebDriver driver = new SelendroidDriver(new URL("http://localhost:4444/wd/hub/status"), capa); 
+0

不,它不工作這種方式:( – Sandeep 2015-02-23 11:42:25

+0

它會拋出什麼錯誤?它應該工作。如果它引發UnReachableBrowserException,請將您的機器的IPv4地址放在本地主機的地方。在我的情況下,這工作得很好:selendroidDriver = new SelendroidDriver(selendroidCapabilities); – 2015-04-21 09:53:11

0

的錯誤是正確的...ü[R傳遞是從io.selendroid.common.SelendroidCapabilities而不是org.openqa.selenium.Capabilities能力......和u [R另一件事也通過字符串代替URL對象...

相關問題