码迷,mamicode.com
首页 > 编程语言 > 详细

Slenium_java_3 Try demo on 12306.cn

时间:2014-12-01 00:50:58      阅读:223      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   http   io   ar   color   sp   java   

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

标签:des   style   blog   http   io   ar   color   sp   java   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!