对于Selenium类型,方法sendKeys(String,String)未定义

时间:2013-09-03 06:48:04

标签: java selenium junit

我正在使用Selenum,在将测试导出到Junit 4 RC后,我面临编译错误。 selenium.sendKeys未定义 (方法sendKeys(String,String)未定义类型Selenium)

我的环境是Eclipse,Selenium jar从vertion 3.3更新到3.5

附加代码:

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

import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;

public class loginGustCOP_NET {
    private Selenium selenium;

    @Before
    public void setUp() throws Exception {
        selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://shaula01:7001/");
        selenium.start();
    }

    @Test
    public void test() throws Exception {
        selenium.sendKeys("id=categoryId", "0000");
    }

    @After
    public void tearDown() throws Exception {
        selenium.stop();
    }
}

可以做些什么?

1 个答案:

答案 0 :(得分:1)

我想你的意思是版本2.35。您需要使用type(String locator, String text)方法才能将文本写入某些输入。 sendText方法仅适用于Selenium WebDriver。