Verify empety field - Selenium IDE

4,871 views
Skip to first unread message

Thiago Morais

unread,
Oct 27, 2011, 9:34:53 AM10/27/11
to seleniu...@googlegroups.com
How i can verify if the field is empety?

Manar Husrieh

unread,
Oct 27, 2011, 9:45:48 AM10/27/11
to seleniu...@googlegroups.com

Hey,
Try the following it should work:
bool hasText = webdriver.findelement(by.id (” element id“)).text==””;

Regards,
Manar Husrieh

On Oct 27, 2011 3:34 PM, "Thiago Morais" <fun...@hotmail.com> wrote:

P.Malutan

unread,
Oct 27, 2011, 10:26:21 AM10/27/11
to seleniu...@googlegroups.com
Is this syntax based on the google webdriver bindings ?


On 27-Oct-11 4:45 PM, Manar Husrieh wrote:

Hey,
Try the following it should work:

bool hasText = webdriver.findelement(by.id (� element id�)).text==��;

Regards,
Manar Husrieh

On Oct 27, 2011 3:34 PM, "Thiago Morais" <fun...@hotmail.com> wrote:
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.

Moises Siles

unread,
Oct 27, 2011, 10:35:32 AM10/27/11
to seleniu...@googlegroups.com
if you are looking for this in selenium ide, I think you can try the verifyvalue command

This is the description

verifyValue(locator, pattern)
Generated from getValue(locator)
    Arguments:

        locator - an element locator

    Returns:
        the element value, or "on/off" for checkbox/radio elements

    Gets the (whitespace-trimmed) value of an input field (or anything else with a value parameter). For checkbox/radio elements, the value will be "on" or "off" depending on whether the element is checked or not.

Hope that helps


On Thu, Oct 27, 2011 at 7:34 AM, Thiago Morais <fun...@hotmail.com> wrote:
How i can verify if the field is empety?

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/vAvQqsXxh6IJ.

Thiago Morais

unread,
Oct 27, 2011, 10:43:08 AM10/27/11
to seleniu...@googlegroups.com
Manar Husrieh:
i can't understand it, can you explain of way more easy
bool hasText = webdriver.findelement(by.id (” element id“)).text==””;


msiles
so how i can use this command to check if the field is empety?

Moises Siles

unread,
Oct 27, 2011, 10:59:09 AM10/27/11
to seleniu...@googlegroups.com
First, are you using webdriver or selenium IDE????

The command will return true or false I guess

If the textbox is empty the following will return true 

VerifyValue | txtUsername | 

If the textbox have the value moises.siles the following will return true 

VerifyValue | txtUsername | moises.siles

If the value in textbox doesn't match with your value it will return false or the error

VerifyValue | txtUsername | "asdfsasfsdfsda"



--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/qz5nKAx_uT8J.

Manar Husrieh

unread,
Oct 27, 2011, 11:00:58 AM10/27/11
to seleniu...@googlegroups.com

Hi,
First of all, are you using web driver or selenium ide?
If you are using web driver the above statement will work, but this is how it will works:
1) find the field using any locator you wish to use. (what I used above is the id locator i.e. By.id )
2) to get the text of the field I used the text property and I checked if its value is empty.
3) I put the result in a bool variable. Instead of that you could use it in an if statement.
I hope I made my self clearer.
Good luck.
Reguards,
Manar Husrieh

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/qz5nKAx_uT8J.

Thiago Morais

unread,
Oct 27, 2011, 11:26:24 AM10/27/11
to seleniu...@googlegroups.com
msiles, 




If the textbox is empty the following will return true 

VerifyValue | txtUsername | 



it don't works, because if have some text  the selenium don't think it is a error 

Thiago Morais

unread,
Oct 27, 2011, 11:28:01 AM10/27/11
to seleniu...@googlegroups.com



First of all, are you using web driver or selenium ide?


i am using the selenium ide 

Moises Siles

unread,
Oct 27, 2011, 11:35:53 AM10/27/11
to seleniu...@googlegroups.com
I just put some examples in order to show you how can you use the verifyvalue comment, now you can put the locator in your scripts and put the value you want to verify

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/65q53CJffBcJ.

Thiago Morais

unread,
Oct 27, 2011, 12:01:49 PM10/27/11
to seleniu...@googlegroups.com
so it is the problem i want verify if the field is in blank
and if i use the command verifyvalue with value in blank it don't works

Moises Siles

unread,
Oct 27, 2011, 12:16:32 PM10/27/11
to seleniu...@googlegroups.com
Could you paste your script in order to see how are you implementing the code?

Thanks

On Thu, Oct 27, 2011 at 10:01 AM, Thiago Morais <fun...@hotmail.com> wrote:
so it is the problem i want verify if the field is in blank
and if i use the command verifyvalue with value in blank it don't works

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/Qpe5r4xSRMAJ.

Thiago Morais

unread,
Oct 27, 2011, 12:27:23 PM10/27/11
to seleniu...@googlegroups.com
<td>open</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>name=ctl00$cphconteudo$ctl26</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>name=ctl00$cphconteudo$ctl38</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>id=ctl00_cphconteudo_grdIntegracoes_ctl13_HyperLink1</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>id=ctl00_cphconteudo_ucTaxasEmbarqueRodoviaria1_txtLinha</td>
<td>1000</td>
</tr>
<tr>
<td>type</td>
<td>id=ctl00_cphconteudo_ucTaxasEmbarqueRodoviaria1_txtValor</td>
<td>1,00</td>
</tr>
<tr>
<td>type</td>
<td>id=ctl00_cphconteudo_ucTaxasEmbarqueRodoviaria1_txtDataIni</td>
<td>01/08/2011</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>id=ctl00_cphconteudo_ucTaxasEmbarqueRodoviaria1_btnSalvar</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>id=ctl00_cphconteudo_ucTaxasEmbarqueRodoviaria1_gvTaxas_ctl04_LinkButton4</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>id=ctl00_cphconteudo_ucTaxasEmbarqueRodoviaria1_gvTaxas_ctl03_LinkButton3</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>id=ctl00_cphconteudo_txtNome</td>
<td>teste1</td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>05/11/2011</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>id=ctl00_cphconteudo_txtNome</td>
<td></td>
</tr>

Moises Siles

unread,
Oct 27, 2011, 12:56:11 PM10/27/11
to seleniu...@googlegroups.com
So if the textbox is empty the following code should work

<tr>
<td>verifyValue</td>
<td>id=ctl00_cphconteudo_txtNome</td>
<td></td>
</tr>

Take a look in the screenshot

Value.png

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/gyT8x7LzJaUJ.
Value.png
Message has been deleted

Thiago Morais

unread,
Oct 27, 2011, 1:18:20 PM10/27/11
to seleniu...@googlegroups.com
is true, i was doing confusion, thanks a lot ;)

Moises Siles

unread,
Oct 27, 2011, 1:28:34 PM10/27/11
to seleniu...@googlegroups.com
Cool, Glad to help.....

Regards

On Thu, Oct 27, 2011 at 11:17 AM, Thiago Morais <fun...@hotmail.com> wrote:
is true, i was doind confusion, thanks a lot ;)

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/VVW0k-mFCM4J.
Reply all
Reply to author
Forward
0 new messages