selenium 百度登录

private String baseUrl="http://www.baidu.com/";

---------

 @Test
	  public void testLoginB() throws Exception {
	    driver.get(baseUrl);
	    Thread.sleep(500);
	    driver.findElement(By.linkText("登录")).click();
	    driver.findElement(By.id("TANGRAM__PSP_8__userName")).click();
	    driver.findElement(By.id("TANGRAM__PSP_8__userName")).sendKeys("username");
	    driver.findElement(By.id("TANGRAM__PSP_8__password")).click();
	    driver.findElement(By.id("TANGRAM__PSP_8__password")).sendKeys("password");
	    driver.findElement(By.id("TANGRAM__PSP_8__submit")).click();

	  }

  

来源: http://www.cnblogs.com/changshuo/p/3279520.html

posted @ 2017-07-10 17:59  风少🌻  阅读(161)  评论(0编辑  收藏  举报