Pregunta

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

¿Fue útil?

Solución

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/)
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top