|
在订单详情页面,修改佣金保存,运行代码后,可以获取到对应元素
代码如下:
//修改佣金-保存
elementLocation.findElementByXpathClick("/html/body/div[6]/div[2]/form/div/div[2]/div[2]/a[2]", driver);
elementLocation.findElementByXpathClearSendkeys("//*[@id=\'ajaxModal\']/form/div/div/div[2]/div[3]/table/tbody/tr[3]/td[4]/input", "4", driver);
elementLocation.findElementByXpathClick("//*[@id=\'ajaxModal\']/form/div/div/div[3]/button[1]", driver);
//获取佣金
Thread.sleep(10000);
WebElement commission2= driver.findElement(By.xpath("/html/body/div[6]/div[2]/form/div/div[3]/div/div/ul/li[3]/span[2]"));
Thread.sleep(3000);
String comm2=commission2.getText();
System.out.print("修改后佣金:"+ comm2 + "\n");
Assertion.verifyEquals(comm2.contains("4"),true);
运行结果:
修改后佣金:4
开始断言,actual:true expected:true
结束断言
但在详情页面,修改收货人后,点击保存按钮,页面弹出操作成功提示,然后窗口直接关闭。也没获取到对应的元素。但重新进入详情页面发现信息是修改后信息。
具体代码如下:
//修改订单收货信息
elementLocation.findElementByXpathClick("/html/body/div[6]/div[2]/form/div/div[1]/div/div[2]/a", driver);
Thread.sleep(5000);
elementLocation.findElementByXpathClearSendkeys("//*[@id=\'ajaxModal\']/form/div/div/div[2]/div[2]/div/input", "13620000000", driver);
//默认否按钮,点击保存
Thread.sleep(5000);
elementLocation.findElementByXpathClick("//*[@id=\'ajaxModal\']/form/div/div/div[3]/button[1]", driver);
Thread.sleep(3000);
driver.get("https://shoptest.yishion.co/web/index.php?c=site&a=entry&m=ewei_shopv2&do=web&r=order.detail&id=10109");
//获取收货信息
WebElement adress2 = driver.findElement(By.xpath("/html/body/div[6]/div[2]/form/div/div[1]/div/div[1]/ul/li[6]/span[2]"));
Thread.sleep(5000);
String adre2=adress2.getText();
System.out.print("修改后的收货信息" + adre2 + "\n");
Assertion.verifyEquals(adre2.contains("13620000000"),true);
页面的修改提示框显示如下图,请问为什么同样是保存,修改收货信息保存后就直接关闭窗口了。
|
|