/ * 返回访客登录
<h2>
<label for="ctl00_Login2_UserName" id="ctl00_Login2_UserNameLabel">Email</label>
<br />
<input name="ctl00$Login2$UserName" type="text" value="pallavi@ensarm.com" maxlength="100" id="ctl00_Login2_UserName" class="formstyle2" style="width:150px;" />
<span id="ctl00_Login2_UserNameRequired" title="User Name is required." style="color:Red;visibility:hidden;">*</span>
<br />
<br />
<label for="ctl00_Login2_Password" id="ctl00_Login2_PasswordLabel">Password</label>
<br />
<input name="ctl00$Login2$Password" type="password" maxlength="100" id="ctl00_Login2_Password" class="formstyle2" style="width:150px;" />
<span id="ctl00_Login2_PasswordRequired" title="Password is required." style="color:Red;visibility:hidden;">*</span>
<a id="ctl00_Login2_ForgottenPasswordLink" href="ForgottenPassword.aspx">Forgotten password?</a>
</h2>
<h2 align="right">
<span id="ctl00_Login2_FailureText" style="color:Red;">Your login attempt was not successful. Please try again.</span>
<div class="button_right button_fixedwidth">
<a id="ctl00_Login2_ibnLogin" href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$Login2$ibnLogin", "", true, "Login2", "", false, true))">Login</a>
</div>
</h2>
</div>
* /
上面是我的html pagesource我想要带有id ctl00_Login2_FailureText的span的xpath表达式。位于div / h2内的
我尝试了fololowing xpath,但它不起作用: // span [@ id ='ctl00_Login2_FailureText'并包含(text(),'由于最大次数的错误登录尝试,您的帐户已被暂时锁定。')]
答案 0 :(得分:0)
最好试一试:
(将“text()”改为“。”)
//div/h2/span[@id='ctl00_Login2_FailureText' and contains(.,'Your account has been temporarily locked because of a maximum number of incorrect login attempts.')]