Forcing ID's is not too expensive, if you start early with it. It's not only tools like Selenium and BadBoy that "might need" fixed ID's. Also Load&Performance Tools depend on either name or id-attribute and if those attributes change between test-runs or (even worse) between page-views, then you can imagine that you get high bills from the team preparing and executing the tests... It would be nice though, if some setting would tell the JSF-impls to force ID's on all input- and command-related components. THEN the developer would "automatically" specify the IDs from the very beginnning. regards Alexander PS: I like Selenium, using JUnit-tests and Selenium-RC
________________________________ From: Yaron Spektor [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 06, 2007 3:06 AM To: MyFaces Discussion Subject: RE: Selenium and badboy on JSF Thanks Shawn and Rafa, I was actually hoping for a simple solution that does not incur code changes. and forcing the ID's may be too expensive. I will look into the addLocationStrategy I am not sure it would work for us. I was sure selenium was built for such cases, but I guess I was wrong, if I need to redo my application in order to test it then it might not be the right solution. I would be interested to know if anyone had other experiences or suggestions with testing tools that support dynamic id's Yaron ________________________________ From: Bertrand, Shawn R [mailto:[EMAIL PROTECTED] Sent: Monday, November 05, 2007 3:39 PM To: Yaron Spektor; MyFaces Discussion Subject: RE: Selenium and badboy on JSF You could use the location strategy feature introduced in Selenium Remote Control 0.9.2: http://release.openqa.org/selenium-remote-control/0.9.2/doc/java/com/tho ughtworks/selenium/DefaultSelenium.html#addLocationStrategy(java.lang.St ring,%20java.lang.String) We use it for the Trinidad tree control to allow our tests to click on the arrows next to each tree node regardless of the underlying index of the node (our locator is the displayed tree node text). This of course is possible only because the tree is rendered in a very flat way using the table renderer (thank goodness for that...). Regards, Shawn Bertrand Tyco Electronics Corporation ________________________________ From: Yaron Spektor [mailto:[EMAIL PROTECTED] Sent: Monday, November 05, 2007 2:13 PM To: MyFaces Discussion Subject: Selenium and badboy on JSF Hi, I was trying out Selenium and badboy today. I couldn't make any of them work for me. For example I used Selenium IDE and tried to record a very short session: 1. Go to a search page 2. click an id of a user ("1111") 3. click on "search" ("form1:doSearch") 4. from a list of users in a table, click on the link of this user id ("form1:_id25:0:comp_760"). As I am working with JSF creating a dynamic id for each component the first time around I recorded "form1:_id25:0:comp_760" after that I got "form1:_id25:0:comp_930" etc. (the comp number changed). How do I make Selenium (or badboy for that matter) realize this is the same link? I googled this for a long time not finding any solution. I tried xpath but it gave me the same "form1:_id25:0:comp_760", I also tried using the xpath table location and it didn't work: ("//tr[2]/td/table.1.0") Here is the source from selenium IDE on my first attempt: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>New Test</title> </head> <body> <table cellpadding="1" cellspacing="1" border="1"> <thead> <tr><td rowspan="1" colspan="3">New Test</td></tr> </thead><tbody> <tr> <td>open</td> <td>/proj/employeeSearch.faces</td> <td></td> </tr> <tr> <td>type</td> <td>form1:_id22</td> <td>1111</td> </tr> <tr> <td>clickAndWait</td> <td>form1:doSearch</td> <td></td> </tr> <tr> <td>clickAndWait</td> <td>form1:_id25:0:comp_760</td> <td></td> </tr> </tbody></table> </body> </html> Yaron

