Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Automated tests 验证用户名或密码字段为空或不正确时显示的错误消息_Automated Tests - Fatal编程技术网

Automated tests 验证用户名或密码字段为空或不正确时显示的错误消息

Automated tests 验证用户名或密码字段为空或不正确时显示的错误消息,automated-tests,Automated Tests,我是硒的新手。我正在为登录页面编写测试脚本,我的问题是:如果输入的用户名和密码不正确&单击登录按钮后将显示错误消息。我想通过selenium验证我是否收到了错误消息。我还想在控制台窗口上显示它。我试着用 WebElement ErrorMsg = driver.findElement(By.xpath("//*[contains(text(),'Password cannot be blank')]")); System.out.println("" +ErrorMsg); 但它不起作用 提前

我是硒的新手。我正在为登录页面编写测试脚本,我的问题是:如果输入的用户名和密码不正确&单击登录按钮后将显示错误消息。我想通过selenium验证我是否收到了错误消息。我还想在控制台窗口上显示它。我试着用

WebElement ErrorMsg = driver.findElement(By.xpath("//*[contains(text(),'Password cannot be blank')]"));
System.out.println("" +ErrorMsg);
但它不起作用

提前谢谢