Quality Testing

Quality is delighting customers

Anybody can give me xpath for textarea node in below HTML code

<li><div style="width: 255px;" unselectable="on"><div class=" nicEdit-panelContain" style="overflow: hidden; width: 100%; border: 1px solid rgb(204, 204, 204); background-color: rgb(239, 239, 239);" unselectable="on"></div></div><div style="width: 255px; border-width: 0pt 1px 1px; border-style: none solid solid; border-color: -moz-use-text-color rgb(204, 204, 204) rgb(204, 204, 204); overflow-y: auto; overflow-x: hidden;"><div class=" nicEdit-main " contenteditable="true" style="width: 247px; margin: 4px; min-height: 45px; overflow: hidden;"> </div></div><textarea id="tempVar8" name="City" style="display: none;"> </textarea></li>

Views: 4047

Reply to This

Replies to This Discussion

Xpath :

a. //textarea[@id='tempVar8' and @name='City']

b. //textarea[@id='tempVar8']

c. //textarea[@name='City']

d. //li/textarea[@id='tempVar8' and @name='City']

e. //li/textarea[@id='tempVar8']

 

Instead of XPath if you will use CSS-Locator which will be very faster for automation purpose.

 

Below CSS-Locators for your HTML code :

a. css=textarea#tempVar8

b. css=textarea[name='City']

 

Please refer the below link : 

http://www.qualitytesting.info/profiles/blogs/css-locator-stratergy...

 

Regards,

-Girija

I suggest u to go ahead CSS usage to resolve u r query. 

Still if u r facing problem then go ahead with HREF

 

 

all the best.

I tried with CSS still getting same problem

Hi balur,

How to locate element with href can you help me for above code?

are u using firebug & firepath? if not please start using it. Is that textarea inside editor??
Am using firebug,Yes text area is inside editor only

Is your problem solved?

No Sasikumar...

Hi Testers, pls give me suggestion

Hi Manoj

as text area in under "li" not any div so xpath would be like this. it will identify all text area having id contains "temp" and name contains "city".

//textarea[contains(@id,'temp') and contains(@name,'City')]

Hi Manvendra,

I tried this xpath "//textarea[contains(@id,'temp') and contains(@name,'City')]" but unfortunately didnt worked for me, is there any other way to resolve it?  

If you trying to test nicEditor fields with Selenium, I guess this may help:

|type|City|TestCity
|getEval|var doc=window.document.getElementById('myiframe').contentDocument; var textarea=doc.getElementById('html'); var nicEditDiv=textarea.previousSibling.childNodes[0]; nicEditDiv.innerHTML=textarea.value;

At least, this works well for me.

RSS

TTWT Magazine


Advertisement

Advertisement

Advertisement

Advertisement

© 2020   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service