Question

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').

Était-ce utile?

La solution

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/)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top