473,379 Members | 1,201 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Is it possible to retrieve http response status?

I am using Selenium, a javascript framework for automated testing of
web application. The problem occurs when there is a server side HTTP
redirect. Selenium would detect that a new page is loaded, proceed to
the next command which then fail because the browser is carrying out
the redirect. So, is it possible to use javascript on the browser
side (Firefox 2) to get the http response status code?
Jun 27 '08 #1
2 6397
Khai Doan wrote:
I am using Selenium, a javascript framework for automated testing of
web application. The problem occurs when there is a server side HTTP
redirect. Selenium would detect that a new page is loaded, proceed to
the next command which then fail because the browser is carrying out
the redirect. So, is it possible to use javascript on the browser
side (Firefox 2) to get the http response status code?
If you use XMLHttpRequest to make an HTTP request then you can read out
the status and statusText properties:
http://developer.mozilla.org/en/docs/XMLHttpRequest

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jun 27 '08 #2
Martin Honnen wrote:
Khai Doan wrote:
>I am using Selenium, a javascript framework for automated testing of
web application. The problem occurs when there is a server side HTTP
redirect. Selenium would detect that a new page is loaded, proceed to
the next command which then fail because the browser is carrying out
the redirect. So, is it possible to use javascript on the browser
side (Firefox 2) to get the http response status code?

If you use XMLHttpRequest to make an HTTP request then you can read out
the status and statusText properties:
http://developer.mozilla.org/en/docs/XMLHttpRequest
XHR handles server-side redirects transparently, so it cannot be used to
detect whether a redirect took place. The value of the status property is
either a success status code (2xx) or an error status code (4xx or 5xx)[1],
never that of a redirect (3xx).
PointedEars
___________
[1] It may be also 0 when using XHR to access the local filesystem directly.
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Kevin Jackson | last post by:
If I have something like this... if Count > 0 Response.Status = "400" else Response.Status = "200" end if The status is always set to 400 even if count is zero...
3
by: Lucvdv | last post by:
I want to return a 404 response from an ASP script (IIS 5). Response.Status lets me set the response string, but if I don't include any HTML text myself, the result is an empty page. Is there...
0
by: diarmaid | last post by:
Hi, I have a password-protected area on my site. I'm not using any server authentication methods: Instead I prompt the user for a username and password using an HTML form and check these against...
4
by: Chris Fink | last post by:
How do I retrieve the HTTP Status code (ie 202, 404, etc) below? I am currently receiving the response text but unable to access the response status code. string strNewValue; string...
1
by: Christian Knoblauch | last post by:
Hello, i have a question regarding HTTP request/response using ASP.NET. PROBLEM: My client-application is behind a firewall, so that the server must be reached using HTTP. A started job on...
1
by: chandra.somesh | last post by:
I generally use Response.Redirect(url,false) for redirections. Is there a size constarint on the HTTP Response Location Header ? Also Is the behavior defined if we exceed this limit? In my...
2
by: pbd22 | last post by:
Hi. I feel like i should know this but i dont. How do I get the server to send a specific HTTP response to the browser? I want to tell the browser that there is no content coming back from...
0
by: burkenstein | last post by:
This looks like the important part: 2010-04-26 16:14:40.049848 wsdl: HTTP ERROR: Unsupported HTTP response status 403 Forbidden (soapclient->response has contents of the response) 2010-04-26...
2
by: neovantage | last post by:
Hi geeks, We made a Java Servlet which takes 3 parameters and upload files from source path to remote path. The three parameters are password, source path and destination path. When we run this...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.