Check_code_five

package Ccwp;
import org.openqa.selenium.By;
//import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriver.Navigation;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;


public class Check_code_five {


/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver","E:\\autotest\\chromedriver_win3224\\chromedriver.exe");
//System.setProperty("webdriver.chrome.driver","E:\\GoogleChrome39/GoogleChrome39/GoogleChromePortable.exe");
 WebDriver driver1=new ChromeDriver();
// JavascriptExecutor jse=(JavascriptExecutor) driver1;
 Navigation navigation1=driver1.navigate();
navigation1.to("http://ccwp.sit.sf-express.com/service/setLogin?openId=OuoHUVYgQ7C%2BK4IjT3f8pWcTDbmpvKZWm7oa%2BWtN3mUQCYxETDvGao%2BZLzOHbRwk01&phone=13692212840&channel=1");
try{Thread.sleep(4000);
}catch(InterruptedException e){e.printStackTrace();}
navigation1.to("http://ccwp.sit.sf-express.com/page/alipay/index.html");
try{Thread.sleep(3000);
}catch(InterruptedException e){e.printStackTrace();}
driver1.manage().window().maximize();
try{Thread.sleep(3000);
}catch(InterruptedException e){e.printStackTrace();}
//點擊賬戶信息,我的地址簿
WebElement address_book=driver1.findElement(By.xpath("//*[@id='bindForward']/div/p/span"));
address_book.click();
try{Thread.sleep(2000);
}catch(InterruptedException e){e.printStackTrace();}
//點擊更換關聯手機號碼
WebElement change_mobile=driver1.findElement(By.xpath("//*[@id='wrapper']/section[1]/form/ul/li/div[4]/a"));
change_mobile.click();
try{Thread.sleep(2000);
}catch(InterruptedException e){e.printStackTrace();}
for(int i=1;i<=6;i++)
{
WebElement mobile_number=driver1.findElement(By.xpath("//*[@id='phoneNo']"));
mobile_number.sendKeys("13418938040");
try{Thread.sleep(2000);
}catch(InterruptedException e){e.printStackTrace();}
//System.out.println("111111111");
WebElement checkcode_button=driver1.findElement(By.xpath("//*[@id='linktext_1']"));
checkcode_button.click();
try{Thread.sleep(3000);
}catch(InterruptedException e){e.printStackTrace();}
System.out.println("這是第"+i+"次點擊驗證碼");
driver1.navigate().refresh();
try{Thread.sleep(4000);
}catch(InterruptedException e){e.printStackTrace();}
}
}


}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章