How do I add a custom attribute to a component?

asked 2020-03-23 03:57:10 +0800

nikidea gravatar image nikidea
3 1

updated 2020-03-23 03:57:43 +0800

Hi ZK Forum, I need help creating a custom attribute which should show when we "inspect element" in the browser. I need a static id for automation testing purposes For example,

<listbox static-id="searchResultListbox">

how to create a custom attribute like 'static-id' above? I want this static-id element to be available for all components.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2020-03-23 09:57:02 +0800

cor3000 gravatar image cor3000
5114 2 7
ZK Team

updated 2020-03-23 09:59:27 +0800

The possible methods are explained in a dedicated Section of our Testing Tips.

in short:

  • if you don't need the DOM id use ZK's component/widget ID jq('$myWin $myButton')

    • possible in JS based testing frameworks (e.g. testcafe)
    • or those with JS access (such as selenium)
  • if you need a DOM id you have to implement an IdGenerator and ensure yourself the generated IDs are unique across the whole desktop (browser tab)

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2020-03-23 03:57:10 +0800

Seen: 5 times

Last updated: Mar 23

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More