-2

我是一名 Java 程序员,我是使用 selenium 库的新手,我想熟悉这一点。我在 Google 中搜索了大量页面,但找不到学习基本 selenium 编程的正确位置。请建议我一个很好的链接来完成硒初学者的基本程序。

我的期望是打开并执行一些操作,例如单击按钮、向下拖动滚动条、下拉列表等。

4

2 回答 2

1

Selenium 官方文档,合而为一。

http://www.seleniumhq.org/docs/

此外,谷歌组和 stackoverflow 更好的方式。

于 2013-10-24T09:44:19.923 回答
0
    package nandu;
    import java.util.concurrent.TimeUnit;
    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;
    import org.openqa.selenium.support.ui.Select;
    import org.testng.annotations.AfterMethod;
    import org.testng.annotations.BeforeMethod;
    import org.testng.annotations.Test;
    public class Webpack {

    WebDriver d;

    @Test
    public void testAjax() throws Exception
    {
        d.manage().timeouts().implicitlyWait(3,TimeUnit.MINUTES);
        d.manage().window().maximize();

        d.get("http://www.veethi.com/places/india_banks-ifsc-micr-codes.html");


        Select bank=new Select(d.findElement(By.id("selBank")));
        bank.selectByIndex(4);
        Select state=new Select(d.findElement(By.id("selState")));
        state.selectByVisibleText("Andhra Pradesh");
        Select city=new Select(d.findElement(By.id("selCity")));
        city.selectByVisibleText("Hyderabad");
        Select branch=new Select(d.findElement(By.id("selBranch")));
        branch.selectByVisibleText("Banjara Hills");


        Thread.sleep(5000);


  }

    @BeforeMethod
    public void initilaization() throws Exception
    {
        d=new FirefoxDriver();


    }
    @AfterMethod
    public void teardown()
    {
        d.quit();
    }

}
于 2014-02-25T09:07:05.303 回答