Checking how many characters were entered

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Checking how many characters were entered

Leandro E
Hi guys. I have the following doubt.

I need to check how many characters is a field accepting to enter.

For example:
FIELD A accepts up to 5 characters. It has an input validation.

So, I send :
getDriver().findElement(By.id("FIELD A")).sendKeys("1234567");

I need to check if the text entered was "12345" (instead of "1234567").

Any recomendation??
Thanks!

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Checking how many characters were entered

Tomek Kaczanowski-3
Hi Leandro,

I guess something like
getDriver().findElement(By.id("FIELD A")).getValue() or .getText() or
sth similiar

but I guess you would have more chances for a response if you asked
this question on Selenium users group :)

Cheers!

2013/8/26 Leandro E <[hidden email]>:

> Hi guys. I have the following doubt.
>
> I need to check how many characters is a field accepting to enter.
>
> For example:
> FIELD A accepts up to 5 characters. It has an input validation.
>
> So, I send :
> getDriver().findElement(By.id("FIELD A")).sendKeys("1234567");
>
> I need to check if the text entered was "12345" (instead of "1234567").
>
> Any recomendation??
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "testng-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [hidden email].
> To post to this group, send email to [hidden email].
> Visit this group at http://groups.google.com/group/testng-users.
> For more options, visit https://groups.google.com/groups/opt_out.



--
Regards / Pozdrawiam
Tomek Kaczanowski
http://practicalunittesting.com

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Checking how many characters were entered

praveen133t
In reply to this post by Leandro E
The best way is to getDriver().findElement(By.id("FIELD A")).sendKeys("1234567"); 

and then String textActual = getDriver().findElement(By.id("FIELD A")).getAttribute("value");  ----> This will give you the value in that textbox

and then

Assert.verifyEquals(textActual.length(), Expected);

Thanks,
Talon

getDriver().findElement(By.id("FIELD A"))

On Monday, August 26, 2013 10:26:27 AM UTC-5, Leandro E wrote:
Hi guys. I have the following doubt.

I need to check how many characters is a field accepting to enter.

For example:
FIELD A accepts up to 5 characters. It has an input validation.

So, I send :
getDriver().findElement(By.id("FIELD A")).sendKeys("1234567");

I need to check if the text entered was "12345" (instead of "1234567").

Any recomendation??
Thanks!

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Checking how many characters were entered

Leandro E
In reply to this post by Leandro E
Thanks Talon, it worked!

On Monday, August 26, 2013 12:26:27 PM UTC-3, Leandro E wrote:
Hi guys. I have the following doubt.

I need to check how many characters is a field accepting to enter.

For example:
FIELD A accepts up to 5 characters. It has an input validation.

So, I send :
getDriver().findElement(By.id("FIELD A")).sendKeys("1234567");

I need to check if the text entered was "12345" (instead of "1234567").

Any recomendation??
Thanks!

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.