添加购物车失败
来源:8-13 添加购物车case

19travelSky
2018-11-18
public void tjgwc2(){
int beforeNum;
int afterNum;
String aftercourseNum;
String courseNum = coursePageHandle.getShopCartNum();
try{
beforeNum = Integer.valueOf(courseNum);
System.out.println(beforeNum);
}catch(Exception e){
beforeNum= 0;
}
coursePageHandle.clickAddCart();
try{
driver.switchToMode();
coursePageHandle.clickBuyNow();
}catch(Exception e){
e.printStackTrace();
}
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
aftercourseNum =coursePageHandle.getShopCartNum();
try{
afterNum = Integer.valueOf(aftercourseNum);
System.out.println(afterNum);
}catch(Exception e){
afterNum=beforeNum;
}
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
if(afterNum == beforeNum+1){
System.out.println("添加购物车成功");
coursePageHandle.clickShopCart();
}else if(afterNum>0){
coursePageHandle.clickShopCart();
}
}
写回答
1回答
-
Mushishi
2018-11-18
给的什么错误?
012018-11-20
相似问题