How can I check if the text I'm looking for exists in this html ?
<ul>
<li class="texto">
Warning, invalid login. The login <b> rafael1983 </ b> is already associated with a registered user.
</li>
</ul>
I'm doing this xpath expression to retrieve the text:
//*[contains(child::text(), 'Warning, invalid login. The login rafael1983 is already associated with a registered user.')]
however the "rafael1983" is within the <b> tag, so that expression does not work, anyone know how to solve this?
Try
//*[contains(normalize-space(.), 'Warning, invalid login. The login rafael1983 is already associated with a registered user.')]
or:
//li[contains(normalize-space(.), 'Warning, invalid login. The login rafael1983 is already associated with a registered user.')]
depending on exactly which element you want to match.
It seems a bit strange to me that you want to check for that specific string, including the login name - I would expect that you are interested in ANY 'Invalid login' message.
Related
I am using AUTH 0 server . and I am new to this one. I need passwords confirmation template and in this template a URL field is defined. but I didn't get , where the URL value is defined.
Please check the images attached. while calling the email verification end point the template is mailed in to the mail. but the if we redirect to the URL filed it shows blank.
where I can identify the value of URL and its template design
Please help me
in the 3rd image , I am asking about the {{url}}
The value for {{url}} is just a placeholder - the value comes from Auth0, but AFAIK you can't change the value of this variable. If you want a different URL in your email template, you could just remove '{{url}}' and replace it with any hard coded value.
In your example template above, the email that gets sent to the user will have a "Confirm my account" hyperlink with a href value to whatever the value of {{url}} was substituted with (as mentioned the value comes from Auth0).
When you click on the link, it will go to your Auth0 tenant and update email_verified to true for the specific user clicking on the link. Auth0 will then return a HTTP 3XX redirect response (302 from memory) with a location header of whatever you set as the "Redirect To" field in the email template.
Validation in Spring 3.x using #Valid annotation:
Below is snippet from the messages_en.properties. I have a form having Username and Password field. When user does not enter anything in Username field, it displays both these messages one below other.
NotEmpty.loginBean.username=Username cannot be Empty
Size.loginBean.username=Size must between 5 to 50 characters.
Any HTML tag given in the message.properties is not interpreted.
NotEmpty.loginBean.username=<li>Username cannot be Empty</li>
Above would display <li> as it is.
Questions:
1) Is there any ways to interpret HTML tag and display its output?
2) Can i show single message though both validation fails?
Ad. 1) Yes, use htmlEscape="false":
<form:errors path="nip" cssClass="error" htmlEscape="false" />
Ad. 2) This is actually JSR303's Achilles' heel - it can be done, but is neither easy nor clean (see this issue). Order of validating each annotated field is undefined, so trick is to use #GroupSequence and custom groups like described here or here.
Alternative solution would be to use custom annotation with #ReportAsSingleViolation, but it will not distinct NotEmpty and Size errors as it'll have its own error message.
I have a form to update some profile information. After making changes when the user clicks on the submit button my to be redirected to the profile page.
so after inserting the updated information into database I have the following code to redirect to the profile page:
database query goes here...
redirect('studentprofile/get/$id');
Here the $id is the the profile id and "get" is the function and "studentprofile" is the controller. But this is not working at all. It seems like the "redirect" is not getting the value of $id.
When the user submits data it shows an error saying "The URI you submitted has disallowed characters." and the URL looks like this
http://localhost/sundial/studentprofile/get/$id
would you please kindly tell me what is wrong with my script? Just for your information I am using Codeigniter
Thanks in advance :)
You need the redirect path string to be in double quotes:
redirect("studentprofile/get/$id");
or write it like this:
redirect('studentprofile/get/'.$id);
You are using single quotes use single quotes instead and btw that is not an issue of CodeIgnitor. Read more about strings: http://www.php.net/manual/de/language.types.string.php#language.types.string.syntax.double
I want to be able to provide a message on my screen that says 'The user name or password provided is incorrect'. So I have the following statement in my controller:
ModelState.AddModelError("", "The user name or password provided is incorrect.");
And then on my view I have
#Html.ValidationSummary(true, "Login was unsuccessful.")
But that gives me the message:
Login was unsuccessful
The user name or password provided is incorrect
So how do I just display one of these messages rather than both?
If you want to get rid of the first text why not just use the other overload of the ValidationSummary method?
#Html.ValidationSummary(true)
I have a form that has name, Id, address etc. It needs to refresh after user enters the ID inorder to query and retrieve other information such as major based the entered ID.
Once it refreshes, I retrieve back the entered values via Get method so to retain the entered form values.
Shown below
<?php
$_SESSION['Bid']=#$_GET['Bid'];
$_SESSION['Stufname']=$_GET['fname'];
$_SESSION['Stulname']=$_GET['lname'];
?>
<form name="form1" method="post" action="registration.php" >
<input type="text" name="Bid" value="<?php echo $_SESSION['Bid'];?>"
MAXLENGTH=9 size="9">
</form>
All works fine but i know GET method is unsecure since the variables are now shown in the URL and I want to get away from using get.
I tried session variable in other scripts but in this case, because the page refreshes after entering ID, I am not really sure how to capture and store the form values in the session variables on page refresh without using the GET method as I did above.
Any help would be appreciated.
thanks,
You can use POST rather. You'll be able to figure out the syntax from here: http://www.w3schools.com/php/php_post.asp but I'd recommend doing more research before posting a question.