How to enter value in text feild in pom - pom.xml

I need to enter value 101 in text feild and validate the error message how to write a code by using #find by annotation

Related

Using Xcode UI testing, is it possible to get the value of a secureTextFields element without receiving dots ("•••••")?

I'm working on a project where the UI test has a password field. The password is initially hidden, and the test checks to see if the value of the secureTextField is "••••••••".
// This works
let passwordValue = getValueOf(passwordTextField)
XCTAssertEqual(passwordSecureTextFieldValue, "••••••••")
Next, the password is revealed by tapping an eye icon that shows the password to the user as normal text, not dots. From there, I'd like to assert that the value of of the secureTextField is "password". Is there a property or strategy to do that?

Swift - Cannot get real text from UITextField - get NCIStr result instead

I have a UITextField that has the "Secure Text Entry" checked in my storyboard.
When I assign the text of the UITextField.text property to a variable I get a value of:
class name = _NSClStr
instead of the actual value of the text which is:
ABCD
If I uncheck the "Secure Text Entry" in the storyboard and do the same assignment to a variable I get the actual text.
The code to assign the value is pretty simple:
passFieldText = self.passField.text!
The debugger output for when the secure entry is enabled:
(lldb) print passFieldText
(String) $R0 = class name = _NSClStr
The debugger output for when secure entry is disabled:
(lldb) print passFieldText
(String) $R0 = "ABCD"
I even tried to use a local variable instead of a class variable:
let passFieldText = self.passField.text ?? ""
Same result!
(lldb) print passFieldText
(String) $R0 = class name = _NSClStr
The passFieldText is passed along to another function to validate the password and in that other function it also shows a value of class name = _NSClStr
What am I missing?
Cheers!
I had the same issue, the only way to fix it is to interpolate the String:
password = "\(self.passField.text)"
It's not exclusive for print()
So the cause of my problem was not the text from the password field. It turned out to be an issue with an external service.
However, to help anyone else to see the actual value of their password fields in code I'll share the suggestion by Dominik 105 and how I implemented it.
To see the value of the password field if I put the PRINT in code I see the actual value of the password field.
print("password1: \(self.passField.text ?? "")")
gives me the result I expect
ABCD
If I do the same PRINT in the debugger output I see the _NSClStr thing.

Error Message Not Displayed Properly and Wrong Input gets selected

I am using jquery select2 method for multiple selections and for users to enter their own input it uses tags property.
Now I want to display the error message when a user enters wrong input.
Therefore, I am using formatResult property of select2 and checking regex for input.
When the input is correct; it returns the input else it returns error message from the function.
But this message is not coming in the format as it comes for select2 example "No matches found" and even when the error message is displayed, on clicking enter it takes the wrong input.
I want to display the message in correct format and not to select the wrong input on enter.
Please help. Below is my code:
$("#abc").select2({
minimumInputLength:1,
maximumInputLength:10,
formatResult: function(term){
if(term.text === 0)
return "Zero Not Allowed";
else return term.text;
}});
In this code, "zero not allowed" is not coming in the same format as "Please enter 1 or more characters" and when we press enter, zero gets selected.

.NET Multiline Textbox Make Shift+Enter working instead of Enter key

I have a Windows Form Multiline Textbox.
I want to use Shift+Enter Instead of using Enter key to make a new line in textbox, and the traditional Enter key will be used to focus on the next control.
I mean Shift+Enter will work exactly like Enter key on normal multiline textbox (Regard to textbox maxlength --> So you cant enter newline, or current selected text will be delete when you insert newline,...)
I've tried to override OnKeyDown, to insert newline on Shift+Enter, but it doesn't work as I expected.
you'll need to override OnKeyDown and check for enter key using the KeyDownEvent's KeyCode property.
If enter was pressed and the keydownevent's modifiers property does not equal Keys.Shift you'll need to suppress the key press. Here's the documentation on how to do that:
http://msdn.microsoft.com/en-us/library/system.windows.forms.keyeventargs.suppresskeypress(v=vs.110).aspx
If shift+enter was pressed you'll need to insert Environment.NewLine at the cursor position, then move the cursor after the inserted Environment.NewLine. Here's how to do that:
How to paste text in textbox current cursor?
Here is my implementation in VB .NET.
Regard to Maxlength of the textbox and current selected text
Protected Overrides Sub OnKeyDown(ByVal e As System.Windows.Forms.KeyEventArgs)
If (Me.Multiline AndAlso e.KeyData = (Keys.Shift Or Keys.Enter)) Then
Dim intRemainCharCount As Integer = Me.MaxLength - Me.Text.Length + Me.SelectedText.Length
'' Check if have enough space to place NewLine
If (Environment.NewLine.Length > intRemainCharCount) Then
MyBase.OnKeyDown(e)
Return
End If
Dim intPos = Me.SelectionStart
Me.Paste(Environment.NewLine)
'' Reset selection start (Reset cusor position)
Me.SelectionStart = intPos + Environment.NewLine.Length
e.Handled = True
e.SuppressKeyPress = True
Return
End If
MyBase.OnKeyDown(e)
End Sub
Change the property for Accept Return for the Multiline doesn't even require coding anything, unless you have an event listening to the KeyDown, in which case you can put a condition to check if the Textbox is focussed.

set UITextLayer text to a CATextLayer?

I have a UIAlertView that asks for input and then the input is saved to a UITextField. I then want to be able to set the string of a CATextLayer to the text of the UITextField. I can NSLog the text in the text field to confirm it was set just fine like this:
NSLog (#"name = %#", nameTextField.text);
But if I try to use similar code to set the string of the CATextLayer:
[nameLayer setString:#"%#", nameTextField.text];
I get an error that says "Too many arguments to method call, expected 1, have 2". What do I need to do to set the string in the nameLayer to be the same as the text in the nameTextField?
The problem is that setString: expects one argument any you're sending two: #"%#" and nameTextField.text.
You sould be doing [nameLayer setString:nameTextField.text]; or even nameLayer.string = nameTextField.text;.

Resources