Does anyone know of a way to get the value of a textfield? I need to validate the text that goes from one iOS screen to another.
I am using the Ruby framework.
Thanks,
Patrick
Does anyone know of a way to get the value of a textfield? I need to validate the text that goes from one iOS screen to another.
I am using the Ruby framework.
Thanks,
Patrick
java like:
driver.findElement(MobileBy.Id("someId")).getAttribute("value")
or
driver.findElement(MobileBy.Id("someId")).getText()
@skycamefalling, If you have the element, you can use the text method:
element.text
Thanks but I am getting an error.
Code: puts shippingaddress.streetaddress1_field.text
Error: Failure/Error: puts shippingaddress.streetaddress1_field.text
ArgumentError:
wrong number of arguments (0 for 1)
Thatâs odd. You say you are using Ruby. Can you provide the code showing how you obtained shippingaddress.streetaddress1_field?
def streetaddress1_field
element(:textfield, âStreet Address Line 1â)
end
This is in my page object. Is there something I need to ârequireâ for .text to work?
Does this element method find the element by some type that recognizes :textfield? I canât answer that question from looking at your code. Print out the class and available methods and you will likely have the answer
I will give that a shot - thanks!
im currently having the same problem, is there any solution to this?
Is there a method, where i can check if the text field is filled with a text? Like i proceed to the next screen only when the OTP is filled. I am giving a sleep command which I dont want to, dont like hardcoding.
So, is there something, i can assert in the text field, whether its filled with numbers or not? like find_element().size > 0?
find_element.text.size > 0
If your text field is prepopulated with default text, youâll need to check that condition as well