Update Text Field While Automating iPhone App - iphone

I am automating an iPhone App. The scenario is Login Logout and re-Login. But while re-login the username and password field is displaying the details. I am trying to list that xpath as a WebElement and clear() that field if(Webelement.gettext() !="") But it is not happening as in the existing framework is taking xpath as String and typecast the String to WebElement is not Possible. Is there any other way to achieve that?? Kindly Help me.

Call this method before passing the value to the Locator.
method_name(){
Actions actionObj = new Actions(driver);
actionObj.keyDown(Keys.CONTROL)
.sendKeys(Keys.chord("A"))
.keyUp(Keys.CONTROL).keyUp(keys.DELETE)
.perform();
}
findElement By xpath add a condition like getText()!="" and then It will be done.
Is it working??

Related

Send a code for password reset via email - Swift + Firebase

I am creating a simple Swift app. I have got the login working with Swift app. Now, when a user clicks on forgot-password, I want to send them an email with a code. Once he enters that code, he can enter a new password.
I looked up at Firebase.auth.auth() I saw functions like checkActionCode() and applyActionCode() - I couldnot understand a clear difference between them!
I also saw some other functions like confirmpasswordReset() and verifyPasswordResetCode().
However, I do not understand what function to use and how to send an email with the code. Can someone give me an overview of how can I do this? Thank you!
If the user forgot their password, you can send them a password reset email with:
Auth.auth().sendPasswordReset(withEmail: email) { (error) in
// ...
}
This email contains so-called OOB code and a link to an auto-generated page that allows them to reset their password. I recommend getting started with this approach, since you'll have to do the least work to get it up and running.
If you want to create your own page instead of the auto-generated one, have a look at the documentation on custom email action handlers. That page also contains an example showing how to call the handleResetPassword, handleRecoverEmail, and handleVerifyEmail methods.

Stop "?" from being added to URL

I currently have an Angular 2 app where the user can submit a form to create a new item. When the submit button is clicked, it calls a function that sends the data to the server and navigates to a new page when the server confirms that the data has been saved successfully.
My problem comes because the form submission appends the form parameters to the URL. So for example if I had an input named title and submission took me to the route mytitle which is the input for the title field, Angular (or whatever injects the GET parameters) would try to navigate to mysite.com/mytitle?title=mytitle instead of just mysite.com/mytitle. Even adding [ngModelOptions]="{standalone: true}" to all of my inputs still leaves a question mark with no parameters after it.
This is a problem because it causes Angular to reload the app because the given route does not match any routes in my route definitions. Is there a way to disable the GET parameters being injected into the URL entirely? POST doesn't work either because I have nowhere to post to, and my next URL uses data from the form itself.
I found an answer to my question, the "Submit" button defaulted to being of type "submit", so changing it to type "button" removed the GET parameters injection behavior.
Check setValue in your form control. Example: Set value this way this.form.controls['val'].setValue='' rather than assigning an empty value
(i.e. this.form.controls['val'] == 0).
If your problem still exists, kindly add button type submit to the button and manually give the click function access to it.

Grails: calling an action that uses withForm

I have a situation in which I need to reuse an action that has its functionality wrapped in a withForm closure.
Everything works well when submitting the form but when I try to reuse that action in another way I get redirect errors from my browser. Specifically, I need to redirect another action to it, possibly call it with chain, and I also want to call it from a hyperlink.
I'd really like to avoid creating a redundant action or having the invalidToken closure execute the same code. I've tried to find some more details about how withForm works and find out what happens if no token is passed to the closure but the Googles have let me down.
Is this possible? Am I trying to make it do something it can't?
More info:
I have a user edit controller action. It is wrapped with the withForm closure. There are three different cases in which I need to call this controller to render the user edit page:
An admin enters the user's id into an input and clicks the form
submit button (this form uses useToken). This needs to be secured
and protected from duplicate form submission.
An admin selects a user to edit from a list of employees by clicking
on the user's name (a hyperlink). Its possible I could turn this into a form submission with useToken and do some CSS styling to make it look like a link.
An admin creates a new user. When the user is successfully created
the create controller redirects (or uses chain) to the edit
controller. I can't find a work around for this, except to create a redundant controller.
If your code is used in more than one place a controller action isn't the best place to put it. I suggest you to move that piece of code to a service and call it from both actions.
Here is my solution. If anyone has some insight into other methods of solving this please contribute. I'm sure I'm not the only one that has had this problem.
The answer is due, in large part to #Sergio's response. It was far more simple than what I was thinking it would be. I created my edit action without withFormthen call it from another action that wraps the edit action in the withForm.
def editWT(Long uid, Long pid){
withForm{
edit(uid, pid)
}
}
def edit(Long uid, Long pid){
// Do lots of stuff to prep the data for rendering the view
}
This answer isn't innovative or ground-breaking but it works. I hope this helps someone else.

pre populationg password field zend framework

I have created a login form with a remember me checkbox. I have set cookie if the user checks the remember me link. I read the cookie the next time user opens the page. I am able to populate the username field but I'm unable to populate the password field. Is there any way to populate it?
You have to set "true" to the propertie "renderPassword" like:
$password = new Zend_Form_Element_Password('senha');
$password->renderPassword = true;
$password->setValue("Senha");
You should never pre-populate the password field. You would be taking the user's password and putting it in plain text in the value attribute of the element. Here is an example of implementing remember me functionality in Zend Framework. It may not be 100% current, but its a decent jumping off point.
Although I would recommend against this but you can do this in the following way
<script>
$(document).ready(function(){$('#id_of_the_password_field').val('<?php echo $variable_containing_password;?>');});
</script>

GWT and IE7 -- getting the browser to remember passwords

I using GWT and have created a login form. I've tried all sorts of ways to get IE7 to prompt to remember the login info but with no success. I thought that maybe this would have worked (but it didn't):
TextBox submit = new TextBox();
submit.getElement().setAttribute("type", "submit");
Any ideas?
You can simply assign values:
private TextBox mName = new TextBox();
private PasswordTextBox mPassword = new PasswordTextBox();
mName.setText("username");
mPassword.setText("password");
In your case I would store the values in cookies, and read them out on startup.
public static String getLastLoginName()
{
return Cookies.getCookie(LAST_LOGIN_COOKIE);
}
public static void setLastLoginName(String userName)
{
Cookies.setCookie(LAST_LOGIN_COOKIE, userName);
}
I don't know GWT, but you might need to somehow set an attribute on the form tag -
autocomplete="on", which has worked for me on a few occasions.
More info here: http://msdn.microsoft.com/en-us/library/ms533486.aspx
If the password textbox is of type password the bowser should prompt for saving the password...
Make sure the Prompt me to save password in Tools >internet options > content > auto-complete (settings) is checked.
One thing I've been able to do that works is wrapping static elements (elements in the actual HTML page, not ones created via Java).
Both sarego and Drejc hinted at the possible solution:
I'm not sure but you may need a PasswordTextBox to trigger IE's "remember this password" features. Also, IE may be getting confused that the elements are bare and not within a FORM element.
I develop extensively with GWT and we've implemented our own "remember me" feature using cookies, it tends to me more reliable and predictable. And your app can then be in control of removing the remembered password (ie, the corresponding "forget me" feature).