views:

109

answers:

1

In order to have the fast speed of website, the web sever compress (gzip) the html files before sending to our clients. When running selenium tests, it shows a pop-up saying: You have chosen to open ... which is a: Bin file from: http://... Would you like to save this file? "Cancel" "Save File"

It seems that the compressed html file doesn't unzip and browsers recognise it as Binary file.

+1  A: 

I'm not sure why Selenium does this, because it doesn't seem to happen in all cases (in one case, a server that serves up gzip doesn't give selenium problems, but another server does).

However, after some research, I found a somewhat simple solution. Create a custom Firefox profile for selenium to use (you will have to specify the directory via the command line). Then, load up that profile and goto about:config and set "Network.http.accept-encoding" to "". Now firefox will not send out the accept-encoding header, and if your server is configured properly, it will not send back gzipped content in response. Then, your observed error should not occur any more.