how to work with compound class names

1,846 views
Skip to first unread message

sita maram

unread,
Mar 6, 2012, 1:17:43 AM3/6/12
to seleniu...@googlegroups.com
Hi All,

i have a class name like "x-grid3-cell-inner x-grid3-col-UNIQUE_ID", i written below

driver.findElement(By.Classname("x-grid3-cell-inner x-grid3-col-UNIQUE_ID").click();

but above peace of code is not working and showing error like compound class does not supports.(in class name having space between x-grid3-cell-inner and x-grid3-col-UNIQUE_ID, bcz of this space my code is not working).


Please provide solution for that.

--
Thanks and Regards,
M.Sitaramireddy.

santhosh soma

unread,
Mar 6, 2012, 1:37:40 AM3/6/12
to seleniu...@googlegroups.com
Hi,

Can you please try with the following one and let me know the result.

driver.findElement(By.xpath(//input[contains(@class,'"x-grid3-cell-inner')]).click();

Thanks
Santhosh.

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

Jim Evans

unread,
Mar 6, 2012, 5:59:55 AM3/6/12
to seleniu...@googlegroups.com
You'll want to use a CSS selector for finding this element. CSS selectors are designed for exactly this type of element location.

Jayaraman - Inspired to become Software Architect

unread,
Mar 6, 2012, 6:40:02 AM3/6/12
to seleniu...@googlegroups.com
You can try by using xpath with contains/startswith/endwith function.
 
Ex: //div[contains(@class,'xxxx')]
 
-Jay!!

On Tue, Mar 6, 2012 at 11:47 AM, sita maram <maram...@gmail.com> wrote:

Mike Riley

unread,
Mar 6, 2012, 1:46:04 PM3/6/12
to Selenium Users
I found examples simply by searching the group for "compound class",
too.

If the URL doesn't get mangled, look here:
http://groups.google.com/group/selenium-users/browse_thread/thread/8cce47c4db05def8/058008b8451dc56d?lnk=gst&q=compound+class#058008b8451dc56d

Otherwise do the search and you will see examples.

Mike
Reply all
Reply to author
Forward
0 new messages