Check_code_five_xiaomi

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_xiaomi {


/**
* @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?phone=13692212840&openId=2.0%3AoH6SdAHaDltBmW4csZs3%2FjVdCqI%3D&channel=2");
try{Thread.sleep(4000);
}catch(InterruptedException e){e.printStackTrace();}
navigation1.to("http://ccwp.sit.sf-express.com/page/xiaomi/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(4000);
}catch(InterruptedException e){e.printStackTrace();}
// System.out.println("111111111111111");
//點擊更換關聯手機號碼
//WebElement change_mobile=driver1.findElement(By.xpath("//*[@id='wrapper']/section[1]/form/ul/li/div[4]/a"));沒有這個頁面
//change_mobile.click();
//System.out.println("000000000000000000");
try{Thread.sleep(4000);
}catch(InterruptedException e){e.printStackTrace();}
for(int i=1;i<=6;i++)
{
WebElement mobile_number=driver1.findElement(By.xpath("//*[@id='phoneNo']"));//*[@id="phoneNo"]
mobile_number.sendKeys("13218938040");
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();}
}
driver1.quit();
}


}



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