1
<button class="hbutton" h:click="app.items(client.monthlyItems)" style="">Start</button>

How do I use regex in css locator to find h:click="app.items(client.monthlyItems)" for class=hbutton?

SUM
  • 1,651
  • 4
  • 33
  • 57

2 Answers2

1

Not sure what language binding you are using, but you should be able to use xpath to find what you need. Here's an example in python: Try something like this:

driver.find_element_by_xpath("//@*[contains(., 'app.items(client.monthlyItems)')]")

You can also try a starts-with

//*[@*[starts-with(., 'app.items')]]

More details here

Shaunak
  • 17,377
  • 5
  • 53
  • 84
  • I have tried this it does not work because atrribute has ":". I am trying to find regex to locate it – SUM Aug 03 '16 at 19:10
  • Okay I have updated the answer to check with any attribute that contains. See if that works .. – Shaunak Aug 03 '16 at 19:17
0

You just have to escape the colon (:). You can use the CSS Selector below.

"h1[h\\:click='app.items(client.monthlyItems)']"

How to use JSF generated HTML element ID with colon ":" in CSS selectors?

Community
  • 1
  • 1
JeffC
  • 22,180
  • 5
  • 32
  • 55