CcwpAlipayNewOrderClass---selenium下单-alipay
来源:互联网 发布:csgo cpu优化 编辑:程序博客网 时间:2024/04/30 04:30
package Ccwp;
//import java.awt.List;
import java.util.ArrayList;
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 CcwpAlipayNewOrderClass {
/*public static void setMaxScroll(WebDriver driver){
try {
JavascriptExecutor jse=(JavascriptExecutor) driver;
jse.executeScript("scroll(0,953)",null);
} catch (Exception e) {
e.printStackTrace();
}
}*/
//document.body.scrollTop
/*public static void setScroll(WebDriver driver,int height){
try {
String setscroll = "document.documentElement.scrollTop=" + height;
JavascriptExecutor jse=(JavascriptExecutor) driver;
System.out.println("++++++");
jse.executeScript(setscroll,null);
System.out.println("=========");
} catch (Exception e) {
System.out.println("Fail to set the scroll.");
}
} */
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver","files/chromedriver.exe");
//System.setProperty("webdriver.chrome.driver","files/chromedriver.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(1000);
}catch(InterruptedException e){e.printStackTrace();}
WebElement mailstuff=driver1.findElement(By.xpath("//*[@id='wrapper']/section[1]/ul/li[2]/a/h3"));
mailstuff.click();
try{Thread.sleep(2000);
}catch(InterruptedException e){e.printStackTrace();}
WebElement recev_info=driver1.findElement(By.xpath("//*[@id='selectSentHint']"));
recev_info.click();
try{Thread.sleep(4000);
}catch(InterruptedException e){e.printStackTrace();}
//选择收件人
WebElement select_receiv=driver1.findElement(By.xpath("/html/body/section[1]/form/ul/p/li[2]/div/div[1]/div/a/i"));
select_receiv.click();
try{Thread.sleep(3000);
}catch(InterruptedException e){e.printStackTrace();}
WebElement weight=driver1.findElement(By.xpath("//*[@id='wrapper']/section[3]/form/ul/li[5]/div/div[2]/div/a[2]"));
weight.click();
CharSequence[] cs= new CharSequence[1];
cs[0] = "2016年货";
WebElement stuff_name=driver1.findElement(By.xpath("//*[@id='depositum']"));
stuff_name.sendKeys(cs);
CharSequence[] bj= new CharSequence[1];
bj[0] = "1000";
WebElement bao_jia=driver1.findElement(By.xpath("//*[@id='insuredAmount']"));
bao_jia.sendKeys(bj);
CharSequence[] nt= new CharSequence[1];
nt[0] = "易碎物品,小心取放";
WebElement note=driver1.findElement(By.xpath("//*[@id='orderRemark']"));
note.sendKeys(nt);
WebElement note_plus=driver1.findElement(By.xpath("//*[@id='climbStairs']"));
note_plus.click();
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
WebElement target=driver1.findElement(By.xpath("//*[@id='orderConfirmBut']"));
ArrayList<WebElement> o=new ArrayList<WebElement>();
o.add(target);
jse.executeScript("arguments[0].scrollIntoView();", o.get(0));
//executeAsyncScript("arguments[0].scrollIntoView();",driver1.findElement(By.xpath("//*[@id='orderConfirmBut']")));
//setMaxScroll(driver1);
//setScroll(driver1,1000);
try{Thread.sleep(6000);
}catch(InterruptedException e){e.printStackTrace();}
// String js="var q=document.documentElement.scrollTop=10000";
//((JavascriptExecutor)driver1).executeScript("js");
//((JavascriptExecutor) driver1).executeScript(js);
//driver1.executeScript(js);
//WebElement agree_select=driver1.findElement(By.xpath("//*[@id='makeSure']"));
WebElement agree_select=driver1.findElement(By.id("makeSure"));
agree_select.click();
WebElement conf_order=driver1.findElement(By.xpath("//*[@id='orderConfirmBut']"));
conf_order.click();
try{Thread.sleep(5000);
}catch(InterruptedException e){e.printStackTrace();}
String currenturl=driver1.getCurrentUrl();
System.out.println(currenturl);
String wenzi="{%22code%22:%22200%22";
if(currenturl.contains(wenzi))
System.out.println("寄件活动成功!");
else
System.out.println("寄件活动失败!");
driver1.close();
}
}
//import java.awt.List;
import java.util.ArrayList;
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 CcwpAlipayNewOrderClass {
/*public static void setMaxScroll(WebDriver driver){
try {
JavascriptExecutor jse=(JavascriptExecutor) driver;
jse.executeScript("scroll(0,953)",null);
} catch (Exception e) {
e.printStackTrace();
}
}*/
//document.body.scrollTop
/*public static void setScroll(WebDriver driver,int height){
try {
String setscroll = "document.documentElement.scrollTop=" + height;
JavascriptExecutor jse=(JavascriptExecutor) driver;
System.out.println("++++++");
jse.executeScript(setscroll,null);
System.out.println("=========");
} catch (Exception e) {
System.out.println("Fail to set the scroll.");
}
} */
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver","files/chromedriver.exe");
//System.setProperty("webdriver.chrome.driver","files/chromedriver.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(1000);
}catch(InterruptedException e){e.printStackTrace();}
WebElement mailstuff=driver1.findElement(By.xpath("//*[@id='wrapper']/section[1]/ul/li[2]/a/h3"));
mailstuff.click();
try{Thread.sleep(2000);
}catch(InterruptedException e){e.printStackTrace();}
WebElement recev_info=driver1.findElement(By.xpath("//*[@id='selectSentHint']"));
recev_info.click();
try{Thread.sleep(4000);
}catch(InterruptedException e){e.printStackTrace();}
//选择收件人
WebElement select_receiv=driver1.findElement(By.xpath("/html/body/section[1]/form/ul/p/li[2]/div/div[1]/div/a/i"));
select_receiv.click();
try{Thread.sleep(3000);
}catch(InterruptedException e){e.printStackTrace();}
WebElement weight=driver1.findElement(By.xpath("//*[@id='wrapper']/section[3]/form/ul/li[5]/div/div[2]/div/a[2]"));
weight.click();
CharSequence[] cs= new CharSequence[1];
cs[0] = "2016年货";
WebElement stuff_name=driver1.findElement(By.xpath("//*[@id='depositum']"));
stuff_name.sendKeys(cs);
CharSequence[] bj= new CharSequence[1];
bj[0] = "1000";
WebElement bao_jia=driver1.findElement(By.xpath("//*[@id='insuredAmount']"));
bao_jia.sendKeys(bj);
CharSequence[] nt= new CharSequence[1];
nt[0] = "易碎物品,小心取放";
WebElement note=driver1.findElement(By.xpath("//*[@id='orderRemark']"));
note.sendKeys(nt);
WebElement note_plus=driver1.findElement(By.xpath("//*[@id='climbStairs']"));
note_plus.click();
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
WebElement target=driver1.findElement(By.xpath("//*[@id='orderConfirmBut']"));
ArrayList<WebElement> o=new ArrayList<WebElement>();
o.add(target);
jse.executeScript("arguments[0].scrollIntoView();", o.get(0));
//executeAsyncScript("arguments[0].scrollIntoView();",driver1.findElement(By.xpath("//*[@id='orderConfirmBut']")));
//setMaxScroll(driver1);
//setScroll(driver1,1000);
try{Thread.sleep(6000);
}catch(InterruptedException e){e.printStackTrace();}
// String js="var q=document.documentElement.scrollTop=10000";
//((JavascriptExecutor)driver1).executeScript("js");
//((JavascriptExecutor) driver1).executeScript(js);
//driver1.executeScript(js);
//WebElement agree_select=driver1.findElement(By.xpath("//*[@id='makeSure']"));
WebElement agree_select=driver1.findElement(By.id("makeSure"));
agree_select.click();
WebElement conf_order=driver1.findElement(By.xpath("//*[@id='orderConfirmBut']"));
conf_order.click();
try{Thread.sleep(5000);
}catch(InterruptedException e){e.printStackTrace();}
String currenturl=driver1.getCurrentUrl();
System.out.println(currenturl);
String wenzi="{%22code%22:%22200%22";
if(currenturl.contains(wenzi))
System.out.println("寄件活动成功!");
else
System.out.println("寄件活动失败!");
driver1.close();
}
}
0 0
- CcwpAlipayNewOrderClass---selenium下单-alipay
- zencart alipay paypal防止漏单处理 。
- selenium下
- Selenium使用单例模式
- android alipay
- Linux下安装selenium
- Ubuntu下安装Selenium
- linux下安装selenium
- ubuntu下安装selenium
- python下selenium测试报告整合
- centos下的selenium+phantomjs
- windows环境下安装selenium
- python3.6下安装selenium
- CentOS下安装Python&&Selenium
- windows环境下安装selenium
- centos6下 selenium firefox问题
- alipay支付宝招聘
- IOS集成Alipay教程
- Kafka Consumer的底层API- SimpleConsumer
- leetcode:Symmetric Tree 【Java】
- MQ入门
- POM 项目对象模型及 POM.XML文件结构解析
- 【bzoj1132】[POI2008]Tro 计算几何
- CcwpAlipayNewOrderClass---selenium下单-alipay
- Swift 实践之简单购物(UITableView的使用)
- AndridStudio编译错误之——libpng error: CgBI: unhandled critical chunk
- SeaJS
- linux makefile (1)
- 视音频数据处理入门:UDP-RTP协议解析
- C语言判断文件夹或者文件是否存在的方法
- uleb128、sleb128和uleb128p1编码格式介绍
- ElasticSearch学习_陶文6_【03】把 Elasticsearch 当数据库使:简单指标