I'm trying to test form fields on a dynamic page. The fields might occasionally be in a different location, and the id will always be "input_" + some number
.
For example - input_0 = firstname, input_1 = lastname,
etc.
Because of that, I created a loop that goes over all the inputs and checks the values, for example, if the text for this input_i is "First Name", then I will execute the firstname test on this iteration.
Now, I'm printing the text on each loop, and I can see the correct text by this function:
String inputText = inputTextElement.getText(); returns "First Name"
.
System.out.println(inputText); is printing "First Name"
.
So far so good.
But when I'm moving forward to the condition - if (inputText == "First Name"
), the condition returns false.
I'm out of ideas for the cause here. Any suggestions?
I tried inputText.toString() as well, just in case. No luck here, either.