如何收到错误消息: - 身份验证错误,请与您的服务台联系
这是我的副本元素:
<div class="alert alert-error dismissible"
role="alert"
data-rendered="true"
style="overflow: hidden; height: 5.74723px;
padding-top: 1.43681px; margin-top: 0px;
padding-bottom: 1.43681px;
margin-bottom: 0px;"><button class="icon-dismiss" aria-label="Dismiss" type="button"></button>
<p><strong>Error: </strong>authentication error with Transaction contact your help desk</p></div>
我想要xpath
答案 0 :(得分:0)
在Chrome浏览器
下,Xpath工作正常Percent
100.0%
50.0%
20.0%
答案 1 :(得分:0)
要获取错误消息authentication error with Transaction contact your help desk
,您可以使用以下代码块:
String text = driver.findElement(By.xpath("//div[@class='alert alert-error dismissible']//p")).getAttribute("innerHTML");
String[] my_text = text.split("(?=authentication)");
System.out.println(my_text[1]);