繁体   English   中英

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

[英]The method sendKeys(String, String) is undefined for the type Selenium

将测试导出到Junit 4 RC后,即时通讯与Selenum一起使用,即时通讯面临编译错误。 selenium.sendKeys未定义(Selenium类型的sendKeys(String,String)方法未定义)

我的环境是Eclipse,并且Selenium jar从版本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();
    }
}

该怎么办?

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM