小编Nav*_*wal的帖子

如何使用Selenium WebDriver(Selenium 2)和Java键入文本框?

在此输入图像描述 我正在使用Selenium 2.但在运行以下代码后,我无法输入文本框.

    package Actor;
import org.openqa.*;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.junit.*;
import com.thoughtworks.selenium.*;
//import org.junit.Before;
public class Actor {
  public Selenium selenium;
  public WebDriver driver;

  @Before
  public void setup() throws Exception{
  driver = new FirefoxDriver();
      driver.get("http://www.fb.com");
  }
  @Test
  public void Test() throws Exception{
      //selenium.type("id=gs_htif0", "test");
      System.out.println("hi");
      // driver.findElement(By.cssSelector("#gb_1 > span.gbts")).click();
          selenium.waitForPageToLoad("300000000");

          WebElement email=driver.findElement(By.id("email"));

          email.sendKeys("nshakuntalas@gmail.com");
          driver.findElement(By.id("u_0_b")).click();
  }
  @After
  public void Close() throws Exception{
      System.out.println("how are you?");
  }

}
Run Code Online (Sandbox Code Playgroud)

java testing selenium automation selenium-webdriver

11
推荐指数
3
解决办法
12万
查看次数

在selenium中创建测试脚本时,我遇到了以下错误

package javaapplication3;
import java.lang.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.WebDriver;
/**
 *
 * @author kipl74
 */
public class JavaApplication3 {

    /**
     * @param args the command line arguments
     */
    static WebDriver driver = new FirefoxDriver();
    public static void main(String[] args) {
        // TODO code application logic here
        String baseurl="www.google.com";

        driver.get(baseurl);

    }
}
Run Code Online (Sandbox Code Playgroud)

当我运行此代码时,我收到以下错误.怎么解决?

Exception in thread "main" org.openqa.selenium.WebDriverException: f.QueryInterface is not a function
Command duration or timeout: 16 milliseconds
Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:12:12'
System info: host: 'comp74', …
Run Code Online (Sandbox Code Playgroud)

selenium selenium-webdriver

7
推荐指数
1
解决办法
2万
查看次数

如何使用selenium IDE验证网页中图像的存在?

我在用selenium IDE 1.10.0.我正在尝试检查产品类别中图像的存在.我应该使用什么命令来验证图像?

testing selenium-ide

2
推荐指数
1
解决办法
1万
查看次数