有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java类型Selenium的sendKeys(String,String)方法未定义

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

我的环境是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) 个答案

  1. # 1 楼答案

    我想你指的是2.35版。需要使用type(String locator, String text)方法才能将文本写入某些输入sendText方法仅在Selenium WebDriver中可用