首页 > 编程语言 > 详细

Slenium_java_3 Try demo on 12306.cn

时间:2014-12-01 00:47:41      阅读:327      评论:0      收藏:0      [点我收藏+]

I find a nice selenium  java demo on 12306.cn. Because of the website changed alot,the demo not work for12306.cn. For next several days, I have below works.

  • I will  make the demo work (2 days)
  • I will redesign the demo from css selector to xpath(1day). 

Today‘s work as below. more will come  tomorow. :) 

import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;

public class test12306 {
 
	public static void main(String[] args) throws InterruptedException{
 //public static void test()throws InterruptedException{
	 WebDriver wd = new FirefoxDriver();
	 wd.get("http://www.12306.cn/");
	 //WebDriver wd;
	 //wd= new FirefoxDriver();
	// wd.get("www.12306.cn");
	Thread.sleep(1000);
	 wd.findElement(By.cssSelector("img[alt=\"购票\"]")).click(); 
	Thread.sleep(1000);
 }
}

 here is the original owner-> http://blog.csdn.net/xc5683/article/details/9629827

Slenium_java_3 Try demo on 12306.cn

原文:http://www.cnblogs.com/maycn/p/4133941.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!