how to type in textbox using selenium RC

4,441 views
Skip to first unread message

anuja

unread,
Nov 27, 2011, 11:33:44 PM11/27/11
to Selenium Users
Hi ,

I am using

selenium.click("xpath");
selenium.focus("xpath");
selenium.type("xpath","10");

but the problem is when i am clicking on the edit button then the
textbox will open dynamicaly during runtime and the xpath for that is
generated during runtime.
every time when i am running the test it is showing "element not
found".
please help me in solving this issue.

Thanks and Regards,
Anuja

Tarun Bhadauria

unread,
Nov 28, 2011, 12:14:25 AM11/28/11
to seleniu...@googlegroups.com
can you paste two or three instances html of textbox you see when you click on edit button?

Arun Kumar Rout

unread,
Nov 28, 2011, 12:30:33 AM11/28/11
to seleniu...@googlegroups.com
I think you want how to eneter text into the text field...
If this is the case then please do a view souce on that page and find the locator.
say for example:
When I do view source on my page can see
<html>
.
.
.
 
<input type="text" name="username">
<input type="password" name="password">
.
</html>
 
Here is the selenium RC code  to enter values in the text field:
 
selenium.type("//iput[@name='username']","Arun");
selenium.type("//iput[@name='password']","Arun");
 
I believe this helps you...!!
 
Thanks,
Arun

On Mon, Nov 28, 2011 at 10:44 AM, Tarun Bhadauria <tku...@gmail.com> wrote:
can you paste two or three instances html of textbox you see when you click on edit button?

--
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/-/w-m3ExXg-vkJ.
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.

Anuja Jain

unread,
Nov 28, 2011, 12:34:38 AM11/28/11
to seleniu...@googlegroups.com
Whenever i am clicking on edit button, the fallowing html code is getting generated-
 
<td width="50px" height="20px">
       <input id="ext-gen4496" class="x-form-text x-form-field x-form-focus" type="text" name="ext-gen4496" autocompltete="off"
          size="20" style="width: 50px; height: 20px;">
</td>

On Mon, Nov 28, 2011 at 10:44 AM, Tarun Bhadauria <tku...@gmail.com> wrote:
can you paste two or three instances html of textbox you see when you click on edit button?

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.

metha....@gmail.com

unread,
Nov 28, 2011, 12:49:15 AM11/28/11
to seleniu...@googlegroups.com
You can use below:

selenium.type("ext-gen4496", value);

if the name of this input tag is same all the time.




On Nov 28, 2011 11:04am, Anuja Jain <anuja...@gmail.com> wrote:
> Whenever i am clicking on edit button, the fallowing html code is getting generated-
>  
>
>       
>           size="20" style="width: 50px; height: 20px;">
>
>
>

Anuja Jain

unread,
Nov 28, 2011, 1:03:29 AM11/28/11
to seleniu...@googlegroups.com
the id is dynamic so that way wont work for me.
 
Thanks,
Anuja

Pritam Metha

unread,
Nov 28, 2011, 1:19:21 AM11/28/11
to seleniu...@googlegroups.com
if the id name is always starting with "ext-gen", then the below might help you:

selenium.type("//input[starts-with(@id, 'ext-gen')]", value);

Thanks,
Pritam

saran kumar

unread,
Nov 28, 2011, 2:11:57 AM11/28/11
to seleniu...@googlegroups.com
Hi Guys
 
Please try this and let me know
 
this is the xpath for the Text Box
//input[contains(.,'username')]
or
//input[contains(text(),'username')]
 
Thanks and regards

nitin gupta

unread,
Nov 28, 2011, 2:15:02 AM11/28/11
to seleniu...@googlegroups.com
Hi,

I am asking about message body of Gmail.
Thanks & Regards,
Nitin Gupta
9911134166

NagaRaju dasam

unread,
Nov 28, 2011, 6:55:50 AM11/28/11
to seleniu...@googlegroups.com

nitin gupta

unread,
Nov 29, 2011, 1:07:47 AM11/29/11
to seleniu...@googlegroups.com
Hi Naga,

I tried but I not able to locate the message body successfully.
9911134166

Who has confidence in himself will gain the confidence of others.

suman vohra

unread,
Jan 2, 2012, 5:51:53 AM1/2/12
to seleniu...@googlegroups.com
HI .
How to detect textbox i.e. its a search textfield.
Information of the textfield using inspect element is mentioned below:

<input id="zi_search_inputfield" class="search_input" type="text" autocomplete="off" title="Search">

Tried with xpath, but selenium RC code was unable to find textbox.

Used this:      selenium.type("//input[@id=\"zi_search_inputfield\"]", "suman");

Anuja Jain

unread,
Jan 4, 2012, 12:23:24 AM1/4/12
to seleniu...@googlegroups.com
Try this
selenium.focus("//input[@id=\"zi_search_inputfield\"]");
selenium.type("//input[@id=\"zi_search_inputfield\"]", "suman");

Regards,
Anuja


--
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/-/TOLzpQvgBekJ.

tulsi.tester

unread,
Jan 9, 2012, 12:36:40 AM1/9/12
to Selenium Users
HI Anuja,

First you need to identify the xpath of the editable text box. Then
set your cursor position to that editable text box. Then use the type
command. Following are the steps


selenium.setCursorPosition("xpath of search text box","0") --> 0
indicates the numerical position of the cursor in the field
selenium.type("xpath of search text box", "value to be typed);

I works fine.

On Jan 4, 10:23 am, Anuja Jain <anujamj...@gmail.com> wrote:
> Try this
> selenium.focus("//input[@id=\"zi_search_inputfield\"]");
> selenium.type("//input[@id=\"zi_search_inputfield\"]", "suman");
>
> Regards,
> Anuja
>
Reply all
Reply to author
Forward
0 new messages