Need to Delete current password (if Prepopulated) in reset popup window using selenium - selenium

After clicking reset password link I need to verify whether password (i.e testdemo)is prepopulating in current password text box, if so then I need to clear those values.

As far I understood your scenario, you are checking that your password is auto populated in password field and If so then you need to clear that
You can do this - First you need to check is there any value in password field if so then do clear
int passLength = driver.findElement(By.id("Password")).getAttribute("value").length();
if(passLength>0)
{
driver.findElement(By.id("Password")).clear();
}

Related

Copy Value from combo list on login screen to username field on new form

Newer to access...I am trying to copy the value selected from the combobox on the log in screen to a field on the new form that opens after successful login.
The field I need copied is called cmoemployee on the Login form.I need that to go to the username field on the mainframe form.
Any help would be greatly appreciated! I have tried many different ways but I can't seem to get it.
Haha,
I actually know what you mean here. This can be a complete pain as the variables are deleted when you open a new form In general it is better to show what you have tried so people are able to help you fix it. Anyway, I've tried to do this so I know how frustrating it can be. There are two main ways that this can be done. You can open the form with openargs (I do not think this is a good option for you as you will have to have the openargs constantly transferring from one form to the next and will be cleared if one form misses them.
A better option would be to use tempvars which are not deleted. This is the code I used to do something similar:
I am going to assume your combobox is two columns (but only displays one) and the bound column is the primary key to an employee table. In which case this would work (or you can modify it to meet your needs)
Log in:
'Check Password (or however you check it
If StrComp(txt_Password, DLookup("[Password]", "tbl_Employee", "[ID] = " & cmoemployee), 0) = 0 Then
TempVars.Add "MyEmpID", cmoemployee.Value 'TempVars will store the combobox value
Else
Msgbox "Incorrect Password Please try again"
End If
On Load event of mainfraim form:
[UserName] = TempVars!MyEmpID
That should get you started, so you can build the rest. Let me know if you have any questions.

Validate button must be clicked before closing workbook

If user changes/writes into excel sheet then he must click the validate button.If he changes data and tries to save/close excel,pop up must be show to the user. Simply I want to check whether used clicks validate button before closing the workbook. If a single letter is changed by user, user needs to click on validate button. After clicking on validate button ,if user again changes any data ,then too user must get warning that validate before saving/closing.
I don't want to write out all the code for you but what you'll need to do is create an on-change worksheet(Or workbook if you'd prefer) process that sets a custom worksheet attribute or your preferred method of storing a value persisting between sessions. That process will run when anything in the worksheet changes and will be able to set the value of your value so that you know "there has been a change, I am now not validated"
Then you need to create a before save process that checks to see if that value is "not validated" or "validated" (false or true or what have you). You set that process to break the save event and present an error message when the value is "not validated" and allow it when it is "validated".
Then you create a validate button/whatever and a process that sets the value to "validated" (may want to check and only change when the value is not already "validated" but that's up to you).
Then you'll have a set of processes where when the sheet/book changes, the value becomes invalid and saving is prevented. When the validate button is selected, the validate process changes the value to validated and saving is allowed again.

How to generate adidional fields inside Yii form

I have:
Table "user"
id, username, password
Table "freedate"
id, user_id, start_date, end_date
Each user can have 1 or more (unlimited) number of "freedate" entries.
Now i have form with 2 text fields (username and password), and 2 date pickers (one for start date and another one for end date).
How can i enable user to inserd aditional datepicker pairs so they can enter as much of "freedate" entires as they need to?
I was wondering about insertind aditional button inside form, that would somehow create aditional fields when pressed, but u have no idea how to do it.
I don't need working example (even tho one would help ofc). What i need i suggestion from your own expirience if you had similar problem.
You can use javascript as noted above. Though that can get tricky to get the new fields associated with the datepicker.
You can also submit after each pair is entered. On returning back to form after save insert a new set of start/end date fields to the end of the form. This way they always have a freedate pair they can enter. (a bit slower overall)
You need javascript to generate these fields on the fly. Or a fixed amount of extra fields could be hidden and shown one by one using javascript as the user clicks the button. You would need to keep track of the number of fields being shown in a javascript var.
You need to write custom javascript in order to do that. It isn't hard, you would need to do something along these lines:
You need to create a button and, when that button gets clicked (onClick event or jquery click() function) you can add the html for your field (<input type=.... /> and so on to your form) and remember to use the correct name for these fields so that they get sent correctly when the user submits the form.

How do i use set_focus_child to set focus to a text entry in gtkmm?

I have a dialog in which i ask the user to enter username and password. I match them with database. If the user field is empty, i show a message box telling the user that user id is blank. I want the focus to set to user id field. How do i do that in gtkmm? Is it possible to clear the existing contents of the user id?
l_user_id=m_user_id->get_text();
l_password=m_password->get_text();
if(l_user_id=="")
throw_dialog("Empty Field","Please enter a user name");
// i want to clear the user id field
// i want to set focus to user id field
Use Gtk::Widget::grab_focus() and Gtk::Entry::set_text.
l_user_id.set_text("");
l_user_id.grab_focus();

vb.net, I have only one textbox in the form and the validate event won't fire

I'm trying to make a text box where you can enter a page number and the form will change. I'm using a textbox to allow the user to enter a page number and I want the form to change when the are no longer actively editing the textbox, the problem is that the textbox is the only editable control in the form so it never loses focus and the validating event never fires. Is there any way to do this?
As matzone said use the keypress but not for the page number keys.
For example, say your user wants to goto page "51", then the user can type 51 and press the return key.
Have the events fire on the return key,
private void TextBox1_KeyDown(object sender, KeyEventArgs e)
{
//13 is the keycode for Return
If (e.KeyCode == 13)
{
//SuperAweomseEventGoesHere
}
}
Use a button as was mentioned to indicate the user wants to load a new page.
Use the validating event to make sure the user entered a valid value.
Alternatively:
If your page numbers are all double digits you could also use the TextChanged event and keep checking if the text value equals a page number. Having at least 2 digits is important since 1 will load a page and the user won't be able to load 10
Another alternative:
Use a NumberUpDown control or a combobox so the user is restricted to the proper values