Checking HTTP Status in Selenium

0 votes

Can I check the HTTP status code in Selenium, If yes then How?

I  have main interest in Selenium RC, but if someone knows the answer for selenium web driver then, I can probably easily translate it into RC.

Jun 7, 2018 in Selenium by Atul
• 10,240 points
94 views

1 answer to this question.

0 votes

This might not be the best use of Selenium for this type of test. There is unnecessary need to load a browser when you could do and have a faster running test

[Test]
[ExpectedException(typeof(WebException), UserMessage = "The remote server returned an error: (404) Not Found")]
public void ThrowA404()
{
    HttpWebRequest tasks;
    HttpWebResponse taskresponse = null;
    tasks = (HttpWebRequest)WebRequest.Create("http://foo.bar/thiswontexistevenifiwishedonedayitwould.html");
    taskresponse = (HttpWebResponse)task.GestResponse();
}
answered Jun 7, 2018 by Meci Matt
• 9,460 points

Related Questions In Selenium

+4 votes
2 answers

Can we get the HTTP Response Code in Selenium with Java?

It is indeed possible to get http ...READ MORE

answered Apr 20, 2018 in Selenium by king_kenny
• 3,710 points
25,830 views
0 votes
1 answer

How to capture the status change of a process in selenium, after the process is kickstarted(Run)

For your requirement of capturing and displaying ...READ MORE

answered Apr 14 in Selenium by Jake George
220 views
0 votes
3 answers

How to specify "ENTER" button functionality in Selenium WebDriver code?

using OpenQA.Selenium.Interactions; Actions builder = new Actions(driver); ...READ MORE

answered Feb 12, 2019 in Selenium by anonymous
35,469 views
0 votes
2 answers

How can we take screenshots of tests in Selenium 2 using C#

Hey, try using following code command to ...READ MORE

answered Aug 22, 2019 in Selenium by Abha
• 27,930 points
291 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,510 points
3,133 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,890 points
2,364 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,890 points
2,512 views
0 votes
1 answer

How can I Install Selenium IDE in Firefox

Selenium IDE works with all Firefox versions, ...READ MORE

answered Apr 13, 2018 in Selenium by Meci Matt
• 9,460 points
509 views
0 votes
1 answer

XPath for the elements with no ID or Name in Selenium Webdriver

Use like this or similar to this: //div[@id="top-level-menu-item-3"]/div[@class="filter-label"] //div[@id="top-level-menu1"] ...READ MORE

answered Apr 17, 2018 in Selenium by Meci Matt
• 9,460 points
2,623 views