Tuesday, February 24, 2009

Selenium testing a website's behavior when javascript is disabled

We recently ran into an issue where we had to write a whole series of automated functional tests around an application with javascript enabled and disabled. However selenium uses javascript, so it didnt look like this was possible. Fortunately there is an interesting approach we found to solve this problem.

Selenium allows you to launch the server with a custom firefox profile. We created a profile with the "yesscript" firefox extension configured to turn off javascript on the application being tested. (yesscript maintains a blacklist of websites on which javascript will be disabled). Then we launch the server with that profile and voila, selenium works fine but the application responds as if javascript was disabled.

No comments:

Post a Comment