how to locate the input box with uncertain id

535 views
Skip to first unread message

Jason Zhao

unread,
Jun 17, 2013, 11:05:27 PM6/17/13
to robotframe...@googlegroups.com

hey guys, I need to locate the input box and enter some text,but the id of it varies all the time ,so I can't use the format like "xpath =//input[@id=xxxx]". Any suggestion? thanks advance

the screenshot of the input box with firebugs

Jason 


ChenJie|抽屉

unread,
Jun 17, 2013, 11:18:54 PM6/17/13
to zhaoxu...@gmail.com, robotframework-users
Hello Jason,

Can you try to use "xpath=//input[@class=xxxx]" if the class of this input box was certain and the only input box available at that moment.

+++++++++++++++++++++++++++++++
Daniel Chan (Chan Jie)
E-mail cho...@gmail.com
Blog http://www.ialog.com
Twitter: @chouti
++++++++++++++++++++++++++++++



Jason 


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

Jason Zhao

unread,
Jun 18, 2013, 12:02:03 AM6/18/13
to robotframe...@googlegroups.com, zhaoxu...@gmail.com
Hi Daniel,
  Unfortunately, it couldn't work either, with the error "WebDriverException: Message: u'Element must be user-editable in order to clear it."  I think the class is certain and only input box available, well, thanks for your post , it's  
still a nice try tough.

Jason

On Tuesday, June 18, 2013 11:18:54 AM UTC+8, Daniel Chen wrote:
Hello Jason,

Can you try to use "xpath=//input[@class=xxxx]" if the class of this input box was certain and the only input box available at that moment.

+++++++++++++++++++++++++++++++
Daniel Chan (Chan Jie)
E-mail cho...@gmail.com
Blog http://www.ialog.com
Twitter: @chouti
++++++++++++++++++++++++++++++



On Tue, Jun 18, 2013 at 11:05 AM, Jason Zhao <zhaoxu...@gmail.com> wrote:

hey guys, I need to locate the input box and enter some text,but the id of it varies all the time ,so I can't use the format like "xpath =//input[@id=xxxx]". Any suggestion? thanks advance

the screenshot of the input box with firebugs

Jason 


--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.

Tatu aalto

unread,
Jun 18, 2013, 1:24:53 AM6/18/13
to zhaoxu...@gmail.com, robotframework-users

Ugh

At least for me, picture is so blurred that I cannot read the dom tree. Could you copy/paste the relevant sections, so that one could take closwr look.

-Tatu

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.

Jason Zhao

unread,
Jun 18, 2013, 1:51:17 AM6/18/13
to robotframe...@googlegroups.com, zhaoxu...@gmail.com
Hi Tatu,
 Thanks for your post, the following might be the relevant section. please accept my apology if my ignorance disturbs you even in the slightest way,and I'm really new to this. I only have the basic knowledge of Xpath, but I have been  trying to learn.  

Jason



On Tuesday, June 18, 2013 1:24:53 PM UTC+8, Tatu aalto wrote:

Ugh

At least for me, picture is so blurred that I cannot read the dom tree. Could you copy/paste the relevant sections, so that one could take closwr look.

-Tatu

On 18 Jun 2013 06:05, "Jason Zhao" <zhaoxu...@gmail.com> wrote:

hey guys, I need to locate the input box and enter some text,but the id of it varies all the time ,so I can't use the format like "xpath =//input[@id=xxxx]". Any suggestion? thanks advance

the screenshot of the input box with firebugs

Jason 


--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.

Markus Bernhardt

unread,
Jun 18, 2013, 2:15:58 AM6/18/13
to zhaoxu...@gmail.com, robotframe...@googlegroups.com
Hi Jason,

don't send screenshots, but copy and paste the relevant DOM elements as text to the mail.

As far as I can see the input is inside a iframe. Are you selecting that frame first?

Cheers,
Markus

To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.

Jason Zhao

unread,
Jun 18, 2013, 3:43:50 AM6/18/13
to robotframe...@googlegroups.com, zhaoxu...@gmail.com
Hi Markus,
 thanks for your post, I did select the frame first. DOM elements is as follow:

<div class="ext-mb-fix-cursor">
<input id="ext-gen66" class="ext-mb-input" type="text" style="width: 218px;">
<textarea id="ext-gen68" class="ext-mb-textarea" style="display: none;"></textarea>
</div>

Jason

Kevin O.

unread,
Jun 18, 2013, 12:23:24 PM6/18/13
to robotframe...@googlegroups.com, zhaoxu...@gmail.com
Jason,

To make sure you aren't selecting an element earlier in the DOM than you think, put this statement in there:
${count}=    Get Matching Xpath Count    //input[@class='ext-mb-input']
Should get a 1.

I looked at Selenium's JS, and it throws the exception you are seeing if the element is not textual (it is) or it is readOnly.
Keep in mind your app may have the text box read-only until it is clicked on.
To see if it is the readOnly property causing the failure, put this in your code before the Input Text:
${readonly}=    xpath=//input[@class='ext-mb-input']@readOnly
Should be False.

Good Luck,
Kevin

Kevin O.

unread,
Jun 18, 2013, 12:30:01 PM6/18/13
to robotframe...@googlegroups.com, zhaoxu...@gmail.com
Oops...typo should be
${readonly}=    Get Element Attribute    xpath=//input[@class='ext-mb-input']@readOnly

Jason Zhao

unread,
Jun 18, 2013, 9:28:51 PM6/18/13
to robotframe...@googlegroups.com, zhaoxu...@gmail.com
Hi Kevin,
Thanks for your post, I think I learned how to start to analyse the problem from your constructive suggestions, really appreciate it.
1.${count} =1
2.${readonly}=None. I thought the None could equal to False.


well,it seemed that everything turned into the dead end. therefore I retrospected all the suggestions, and tried them one by one over again. when I looked at Markus's post, it suddenly occurred to me that I might not have fully understood the meaning of frame. I used the firebug to check DOM again and found that iframe with certain id,which I selected first, under which lots of divisions. When I put the mouse cursor on one division, the input box just turned overshadowed. then I thought what if select the division, then I selected the division and tried again,and it turned out to be, Ta-Dah, SUCCESS. The Xpath was //div[@id="ext-comp-1128"]//input[@class='ext-mb-input']

thanks a lot, Daniel ,Tatu and Kevin for kindness ,patience and inspiration. Best wishes.
Jason

Laurent Bristiel

unread,
Oct 21, 2013, 8:38:12 AM10/21/13
to robotframe...@googlegroups.com, zhaoxu...@gmail.com
For future people beeing stuck on the "Element must be user-editable in order to clear it" issue when using "input text" keyword ,
I was facing it as well and the answer could be found in this thread: "your app may have the text box read-only until it is clicked on" => indeed!
Adding a "click element" just before my "input text" was the answer to my problem.
Thanks all,
Laurent
Reply all
Reply to author
Forward
0 new messages