Home > watir > watir div content by class

watir div content by class

December 11th, 2009 dwright Leave a comment Go to comments

Here are 3 identical ways to capture the content in a div by only the class name.

<div class="error">error message here</div>

@ie.div(:class, 'error').text
@ie.div(:class, 'error').innerText
@ie.element_by_xpath("//div[@class='error']").text

all the above return 'error message here'

Categories: watir Tags:
  1. No comments yet.