0

I'm trying to identify <div> elements with ids that are dynamically generated. I want to be able to grab the element using the text identifier.

I don't want to have to know what the exact name is. For example, if there was a div tag containing "This is a div text", I would want to grab that with @browser.div(:text => 'div text').

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Adam6806
  • 87
  • 10

1 Answers1

2

You can use regular expressions to do partial matching of an element's property.

For example, in your situation, you can do:

@browser.div(:text => /div text/)
Justin Ko
  • 46,526
  • 5
  • 91
  • 101