赵小缘 发表于 2017-3-21 17:50:52

selenium java在IE中遇到警报框关闭不了

本帖最后由 赵小缘 于 2017-3-21 18:28 编辑

警报框:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAC8CAYAAADCbJOCAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAABswSURBVHhe7d17cFRVngfwbxKSEN4QIIxgEiABo6KMhkdwdWZW3TLIrsxag8MfZrdqZpKpml0ncWRraxe2rMU/dovdgXFn1LBTMzVxRpSpnUEnJo6AD1AegooGDCEviAaT8Agk4ZGQx/7Oved23+7c7jQhiX3g+6k6pvv27XtvN/d8+3du377GbP/e6j4QERnACqyc1Jn6LhERUPFxjb418hZ8PUPfCrS3oRGx+jYRUdRjYBGRMRhYRGQMBhYRGYOBRUTGYGARkTEYWER0zZb+8Y9WCxZq+mDxPKyo1oSntxzDnBX3IW+8nhSJ9lo8XtqIBwd8XgdK3ngHz7bqu5GYnIX/e2guULkLjx5q0xMjl7Xwm3gxa5x9p/EQsncBG1cvxL32FC3c6w56TL3W94FnZJvS1MPWa29Hvm+Zav4m3N9vHVq/+UkZzHlYTjDt+/a3rb/B9yMV7jwsBlZUG1xgnVBhcm4eDubM0FNCsQOrbsEKPB3JLqACpmK8FVhWOHiJZB5t995SbJ7kCjAt7Pa3d+BEWw0e3fUFVtxnb7c1/6EJdvAFBJB6/w6iNF1C9nbZHus9vJqQnuURpjeGwZ44GlxNXW1YKQwsA6jOW3Rc34mErnT8VUUlKq0HBjIBT/gCUAfWxFmonZShg8MrxHRwLpyAZ0+ECyP7udvT+odQgBDba1dfHXbI6Gl+7u0WQdWZL/xmNfsCK1WCbC3uCtqWCEP6Bq+8ruVM98FWVg4GlilUJ2yY4aos+ldYqmPuTA3qbBF3ruDlOZ33m5hT8RFwj0yHWlajBCLwoLqv5nOqpgXteDSgerKff9XVisf2OoGTf+4dFCE7qLryb/c3vhigehzwvRjkNt9gorXC4kH3aD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YREG8hjUj1Xb8fC1K1i6WUPou8JMfYR4W4Zn9p3Bq/zNYJNXVqVOnsP+ZRWorUftCrj/MBmi5L9R6rm8k2lBiYBEF8ep0I9J2/ASqiMrb0oItahgnfb2v7wDWLpmGaUvW4oBUV9OmTcOStQdkOjA7/3W0tLQEtv3rkZ23pd/01/NnB65rBNtQYmARRYV6FP+3hFW/403ZWL8/MIj2r8/Wj9nqi5fjqZ36znWOgUUUFWajoOy/kKvv+R3EuiXTMX3JOhwsWY3p06djybqD+jGlHm++CmS6j1Hp+XxtebHMdX1gYBEF8RrWjFSzhoH2f9BX8yZexXrsa25G8z6psB7fgma5vc+qsPRzdv4c6w4exLE6ZxnykJ7P117PR7pe/lfRhhIDiyjKvLg6BatfBCpfldLpkQel9grlLTy1uhLr920B5DkPb75e6qjQGFhEQbyqhBFrsv7HX2pCU9M+/A2y8OQP0vV09Ug1ih9OwVIZEmbNTcfOp1YDL5XiB+nfwoamJjx5bClSlsrQ8cXVSElJCWxP7ey/rhFqQ4lXHCVyUVfHfP2RZn2PhsLDr6bwiqNEdONhYBEF8RrWsA2+DSUGFlEQr07HNvg2lBhYRGQMBhYRGYOBRRTEa1jDNvg2lBhYRGQMnodF5ML/Vf3w4P+qnoiuOzxxlIiuGwwsIjIGA4uIjMHAIiJjMLCIyBgMLCIyBgOLiIzBwCIiYzCwiMgYDCwiMgYDi4iMwcAiImMwsIjIGANerYGIaCQN+vIyRETRgpeXISKjMLCIyBgMLCIyBgOLiIzBwCIiY1jfEurbRERRDPh/gwipSIn3fcEAAAAASUVORK5CYII=
代码段:
driver.findElement(By.cssSelector("a > img")).click();
System.out.print("点击了登录");
assertEquals(closeAlertAndGetItsText(), "提示:\n1.密码过于简单,请重新设置密码!"); //这里执行不下去
System.out.print("进入系统");

赵小缘 发表于 2017-3-22 14:54:54

后来加上new WebDriverWait(driver, 10).until(ExpectedConditions.alertIsPresent());问题解决了

梦想家 发表于 2017-5-6 09:42:23

支持一下
页: [1]
查看完整版本: selenium java在IE中遇到警报框关闭不了