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,581
  • 4
  • 30
  • 56

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,260
  • 5
  • 52
  • 86
  • 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
  • 19,228
  • 5
  • 29
  • 49