views:

31

answers:

1

I have a page that results in a text/plain file being displayed in the browser that looks like this:

...
Admin   Site    Administration  2010-04-21 22:26:34 [email protected]
Test Site   Bob Smith   2010-04-21 22:27:09 [email protected]
Admin   Site    Administration  2010-04-21 22:29:26 [email protected]

I am trying to write a Selenium test against this that verifies the last line of the file has "[email protected]" at the end. How would you do this? I can't depend on the date/time as this is a login report that is constantly getting updated - all I want is to ensure that the last line ends with that email address. And I can't figure out how to do it using Selenium expressions, DOM, or XPath.

+1  A: 

OK, I found a way that works, in Firefox at least:

assertText('xpath=//pre', 'regex:.*[email protected]$')

Firefox appears to create a element in the DOM, and you can go from there. I'd be interested to see if there's any better way (especially something more cross-browser).

fool4jesus