Click here to Skip to main content
15,892,537 members
Articles / All Topics

Selenium’s How-To

Rate me:
Please Sign up or sign in to vote.
3.00/5 (1 vote)
28 Nov 2010CPOL1 min read 9.6K   1  
Selenium’s How-To

Recently, I ran into a couple of issues that started affecting some Selenium automated tests I was developing. Below are the issues and solutions implemented:

XHR ERROR: Response_Code = –1 Request Error

When executing the open command, the tests started failing with the following error:

XHR ERROR: URL = https:// Response_Code = -1 Error_Message = Request Error. 
on Firefox version 3.6.12 and Selenium RC version 1.0.3

I found that the issue was reported by other users (issue 408 on Selenium project page). The open command started working again after making the suggested workaround on comment 4, calling the open command and passing the second parameter true:

C#
public void CustomOpen(string url)
{     
    commandProcessor.DoCommand("open", new String[] { url, "true" });
}

According to comment 4, the issue was caused by a feature that was supposed to be disabled.

The issue seems to be related to that second parameter (ignoreResponseCode) on the open command and the default value assigned when it is null or empty, there are more details about the fix on comment 14. The fix hasn't been released yet, so if you run into this issue you can use this workaround.

HTTPS Pages

When running Selenium on development / test environment, usually there is a need to deal with the certificate exceptions thrown by the browser.

I was experiencing the following behavior when running the tests using *firefoxproxy mode. This mode will remember the certificate exception added but if the site is redirected automatically to another location, Selenium throws permission denied exception (I supposed this is related to Same Origin Policy restriction).

Reading a little further, *firefoxproxy mode is supported only for backward compatibility and *firefox mode should be used in Selenium-RC 1.0 beta 2 and later.

I tried the following solutions mentioned here running Selenium using *firefox mode:

Both approaches worked, but the test execution experiences a small delay when using RCE.


This article was originally posted at http://mariangemarcano.blogspot.com/feeds/posts/default

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Denmark Denmark
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --