根據文檔,我看到SelendroidDriver需要傳遞兩個參數。我不確定我是否感到困惑,但編輯根本不允許我只添加 driver = new SelendroidDriver(capa); 當我鼠標懸停時的代碼,我看到這條消息, 「構造SelendroidDriver(SelendroidCapabilities)是未定義 1修復可用 添加參數匹配」 SelendroidDriver(URL,能力)SelendroidDriver構造函數是否需要傳遞兩個參數?網址和功能?
可有人請澄清?
檢查在上述鏈路的構造方法摘要部分。 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;
}
}
}
請檢查您正在使用的Selendroid的版本。最新的是0.14.0。 – 2015-02-23 10:43:48
@VivekSingh是的,我正在使用最新版本 – Sandeep 2015-02-23 11:05:16