[selenium-users] unable to click on a Collapse/Expand Node (’+')

938 views
Skip to first unread message

sanju

unread,
Apr 26, 2010, 11:13:46 AM4/26/10
to Selenium Users, mohame...@hyperquality.com
Hi Everyone,

I am unable to click on a Collapse/Expand Node (’+') using Selenium
(Java). The icon is placed in a Div which is placed in a Table. Please
help! Following is the UI Definition for the element

selenium.click("//div[@id='root']/div/table/tbody/tr[3]/td[2]/div/
div[8]/table/tbody/tr/td/div/div/div[1]/div/div/div[2]/table/tbody/tr/
td[1]/img");

Thanks

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

darrell

unread,
Apr 26, 2010, 2:11:39 PM4/26/10
to Selenium Users
Sanju,

If you post the Selenium code that does not work there is insufficient
information to help you. If this code doesn't work it is obviously
wrong.

I can say a few things. First, try adding an "xpath=" to the string. I
have found this seems to make the code work a little faster and
therefore better.

Second, that is a really long xpath, you might want to see if you can
shorten it. Have a look at http://darrellgrainger.blogspot.com/2010/03/how-to-pick-identifiers.html
for tips on how to shorten it.

Third, usually if you have a collapse/expand widget, it uses
javascript to alter the DOM. The item which you click to expand is
often different from the item to collapse. So you want to examine the
DOM when it is expanded to find the 'collapse' identifier and
collapsed to find the 'expand' identifier.

Posting the HTML code would probably be the most helpful for me to
provide you with an answer to your problem.

Darrell

JAR

unread,
Apr 27, 2010, 12:09:00 PM4/27/10
to Selenium Users
Hi,

Is Collapse/Expand icons are images? If yes, what are the attributes
img tag? Also what is class of div and do you have any text beside the
icon? Try using some css selector.

Regards
JAR
Reply all
Reply to author
Forward
0 new messages