Sunday 6 January 2008

Selenium testing in spite of browser differences

If you're using Selenium table tests for functional testing of your web app, you could have tried testing for browser specific issues. I used selenium vars for that (here in rsel format).

store_eval "if(navigator.userAgent.toLowerCase().indexOf('safari')\
!= -1){'some_locator';} \
else {'some other locator';}",
'specific_part'
assert_element_present '//div//${specific_part}'


*But* most probably, there should be a better way to do this. We used the trick above to look for specific inline style, which is handled differently in safari and firefox ( a space added after a semicolon in safari). We eventually found assert_element_visible.

No comments: