Re: Generated IDs
For my selenium tests I activate the wicket path (set you application in development mode) and use the following class : /** * Use wicket path dans for selenium tests. * * wicket-selenium <http://www.wijsmullerbros.nl/content/wicket-selenium> * */ public final class WicketBy extends By { /** xpath expression. */ private final String xpathExpression; /** wicket path. */ private final String wicketPath; /** * Creates a new instance of {@link WicketBy}. * * @param varWicketPath the wicket path (eg: "id1:id2:id3") */ private WicketBy(final String varWicketPath) { super(); this.wicketPath = varWicketPath; this.xpathExpression = convert(varWicketPath); } /** * Factory method to create this specific By. * * @param varWicketPath the wicket path (eg: "id1:id2:id3") * @return By of type WicketBy */ public static By wicketPath(final String varWicketPath) { return new WicketBy(varWicketPath); } /** * Convertit le wicketpath en regexp xpath. * * @param varWicketPath * @return l'expression pour le xpath */ private String convert(final String varWicketPath) { final String renderedPathVal = wicketPath.replaceAll(":", "_"); return String.format("//*[@wicketpath='%s']", renderedPathVal); } @Override public List findElements(final SearchContext context) { return ((FindsByXPath) context).findElementsByXPath(xpathExpression); } @Override public WebElement findElement(final SearchContext context) { return ((FindsByXPath) context).findElementByXPath(xpathExpression); } @Override public String toString() { return "By.wicketPath: " + wicketPath + " (xpath: " + xpathExpression + ")"; } } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Generated-IDs-tp4677000p4677039.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Generated IDs
Hi, See MarkupSettings#setMarkupIdGenerator(). The default ids are not that random. For a given scenario that starts with a new session the ids will be the same. On Feb 6, 2017 6:27 PM, "Bas Gooren" <b...@iswd.nl> wrote: You can always register a component instantiation listener (or on before render listener etc) in development mode, and let it set markups ids in any way you want to provide stable ids. E.g. a configure listener, which listens for Page instances and runs a visitor over all it’s components to set the markup id according to some algorithm. Met vriendelijke groet, Kind regards, Bas Gooren Op 6 februari 2017 bij 17:25:21, Entropy (blmulholl...@gmail.com) schreef: Yes, but we have a whole lot of existing pages and fields and links and buttons. I was kind of hoping I could just get wicket's generated IDs to be stable from page run to page run, and avoid getting a work request approved to go back and tweak every field. -- View this message in context: http://apache-wicket.1842946. n4.nabble.com/Generated-IDs-tp4677000p4677002.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Generated IDs
You can always register a component instantiation listener (or on before render listener etc) in development mode, and let it set markups ids in any way you want to provide stable ids. E.g. a configure listener, which listens for Page instances and runs a visitor over all it’s components to set the markup id according to some algorithm. Met vriendelijke groet, Kind regards, Bas Gooren Op 6 februari 2017 bij 17:25:21, Entropy (blmulholl...@gmail.com) schreef: Yes, but we have a whole lot of existing pages and fields and links and buttons. I was kind of hoping I could just get wicket's generated IDs to be stable from page run to page run, and avoid getting a work request approved to go back and tweak every field. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Generated-IDs-tp4677000p4677002.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Generated IDs
Yes, but we have a whole lot of existing pages and fields and links and buttons. I was kind of hoping I could just get wicket's generated IDs to be stable from page run to page run, and avoid getting a work request approved to go back and tweak every field. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Generated-IDs-tp4677000p4677002.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Generated IDs
Hi, You can also set the html id directly if you don't need it to be automatically generated ie: div wicket:id="myId" id="myId" Hope this helps, Sebastien. On Mon, Feb 6, 2017 at 4:58 PM, Entropy <blmulholl...@gmail.com> wrote: > Our test team wants to run selenium scripts against our pages, and wants > stable IDs to go against. Wicket tends to generate random, and most > annoyingly, inconsistent ones that change with each run of the page. > > Obviously, we can setMarkupId on every component manually, but I was > wondering if there is a way to get Wicket to generate Ids in a way that is > more predictable, so that 1000 runs of the same page with the same code > will > always produce the same IDs, even if they are generated IDs? > > Like maybe some setting or overriding some class? > > -- > View this message in context: http://apache-wicket.1842946. > n4.nabble.com/Generated-IDs-tp4677000.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Generated IDs
Our test team wants to run selenium scripts against our pages, and wants stable IDs to go against. Wicket tends to generate random, and most annoyingly, inconsistent ones that change with each run of the page. Obviously, we can setMarkupId on every component manually, but I was wondering if there is a way to get Wicket to generate Ids in a way that is more predictable, so that 1000 runs of the same page with the same code will always produce the same IDs, even if they are generated IDs? Like maybe some setting or overriding some class? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Generated-IDs-tp4677000.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Generated IDs in deployment vs. development modes
I've been running our app in development mode for quite a while now and noticed that Wicket likes to append digits to the end of id attributes specified in the html templates. I just switched to deployment mode and now Wicket is completely changing the id attributes. I'm using Prototype to do some JavaScript stuff, and while I could work around this id-changing in development mode, my entire app is broken in deployment mode. Is there any way to tell Wicket to use the development mode id-changing behavior in deployment mode? Better yet, is there a way to tell Wicket to leave the id attributes specified in html templates alone altogether? Thanks, Zach - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Generated IDs in deployment vs. development modes
there are plenty of threads about this on the list if you are interested. the gist of the thing is that wicket changes id so that it can guarantee their uniquness since components are self contained and isolated. there are a two basic ways to deal with this: call setmarkupid(string) for components you want to control the id for, or get the id with getmarkupid() and pass that to js code. -igor On Sat, Mar 22, 2008 at 5:13 PM, Zach Cox [EMAIL PROTECTED] wrote: I've been running our app in development mode for quite a while now and noticed that Wicket likes to append digits to the end of id attributes specified in the html templates. I just switched to deployment mode and now Wicket is completely changing the id attributes. I'm using Prototype to do some JavaScript stuff, and while I could work around this id-changing in development mode, my entire app is broken in deployment mode. Is there any way to tell Wicket to use the development mode id-changing behavior in deployment mode? Better yet, is there a way to tell Wicket to leave the id attributes specified in html templates alone altogether? Thanks, Zach - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Generated IDs in deployment vs. development modes
I'll add two more approaches to that list: 1) Don't associate a wicket component with any html element whose id you need 2) Learn to use other attributes besides id (and praise the prototype developers for their DOM traversal API) ;) Thanks, Zach igor.vaynberg wrote: there are plenty of threads about this on the list if you are interested. the gist of the thing is that wicket changes id so that it can guarantee their uniquness since components are self contained and isolated. there are a two basic ways to deal with this: call setmarkupid(string) for components you want to control the id for, or get the id with getmarkupid() and pass that to js code. -igor On Sat, Mar 22, 2008 at 5:13 PM, Zach Cox [EMAIL PROTECTED] wrote: I've been running our app in development mode for quite a while now and noticed that Wicket likes to append digits to the end of id attributes specified in the html templates. I just switched to deployment mode and now Wicket is completely changing the id attributes. I'm using Prototype to do some JavaScript stuff, and while I could work around this id-changing in development mode, my entire app is broken in deployment mode. Is there any way to tell Wicket to use the development mode id-changing behavior in deployment mode? Better yet, is there a way to tell Wicket to leave the id attributes specified in html templates alone altogether? Thanks, Zach - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Generated-IDs-in-deployment-vs.-development-modes-tp16229462p16229975.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]