Selenium-Response_Code = 404 Error_Message = Not Found

788 views
Skip to first unread message

arihan sinha

unread,
Sep 13, 2010, 1:39:15 PM9/13/10
to seleniu...@googlegroups.com
Dear all

in the webpage i am testing ( www.mflow.com), the page opens fine but in the backend one requrest goes to server which retrieves the 404 error code which subsequently terminates the selenium .
so i am getting the error as
 "XHR ERROR: URL = http://www.mflow.com/ Response_Code = 404 Error_Message = Not Found"
Any workaround pls at selenium end ( not at the code level by developers :) )

you can try this by just navigating to the home page thorugh selenium  ( www.mflow.com)
I am using selenium+Ruby+Rspec

Regards
Arihan



arihan sinha

unread,
Sep 14, 2010, 5:45:02 AM9/14/10
to seleniu...@googlegroups.com
Anyone found any solution for this then pls let me know ??


Cheers
A

arihan sinha

unread,
Sep 14, 2010, 6:20:55 AM9/14/10
to seleniu...@googlegroups.com
I know one solution which would move run my  test like as below
begin
      page.open "/mflow.public/"
    rescue
      page.wait_for_page_to_load "30000"
    end
   

but I want if any way we can ignore that 404 code for that particualr request
as example when we navigate to the www.mflow.com , one rquest goes to the http://www.mflow.com/Account/LogOn which gives 404 error

any workaround so that this particular request (/Account/Logon) if gives 404 error then selenium should ignore that or covert that to status code 200 or blocking the request for this url(/Account/Logon) to server so that test would move forward without giving exception

Cheers
A

pinglin

unread,
Sep 14, 2010, 11:47:34 AM9/14/10
to Selenium Users
try @Test(skipFailedInvocations = true)

On Sep 14, 1:20 pm, arihan sinha <arihan.si...@gmail.com> wrote:
> I know one solution which would move run my  test like as below
> begin
>       page.open "/mflow.public/"
>     rescue
>       page.wait_for_page_to_load "30000"
>     end
>
> but I want if any way we can ignore that 404 code for that particualr
> request
> as example when we navigate to thewww.mflow.com, one rquest goes to thehttp://www.mflow.com/Account/LogOnwhich gives 404 error
>
> any workaround so that this particular request (/Account/Logon) if gives 404
> error then selenium should ignore that or covert that to status code 200 or
> blocking the request for this url(/Account/Logon) to server so that test
> would move forward without giving exception
>
> Cheers
> A
>
> On Tue, Sep 14, 2010 at 10:45 AM, arihan sinha <arihan.si...@gmail.com>wrote:
>
> > Anyone found any solution for this then pls let me know ??
>
> > Cheers
> > A
>
> > On Mon, Sep 13, 2010 at 6:39 PM, arihan sinha <arihan.si...@gmail.com>wrote:
>
> >> Dear all
>
> >> in the webpage i am testing (www.mflow.com), the page opens fine but in
> >> the backend one requrest goes to server which retrieves the 404 error code
> >> which subsequently terminates the selenium .
> >> so i am getting the error as
> >>  "XHR ERROR: URL =http://www.mflow.com/Response_Code = 404

arihan sinha

unread,
Sep 14, 2010, 12:13:49 PM9/14/10
to seleniu...@googlegroups.com

I am using selenium+ruby+rspec and below is code which i am using . could you please let me know where i would put this @Test(skipFailedInvocations = true)

require "rubygems"
gem "rspec"
gem "selenium-client"
require "selenium/client"
require "selenium/rspec/spec_helper"

describe "When I go to the HomPage" do
  attr_reader :selenium_driver
  alias :page :selenium_driver

  before(:all) do
    @verification_errors = []
    @selenium_driver = Selenium::Client::Driver.new \
      :host => "localhost",
      :port => 4444,
      :browser => "*googlechrome",
      :url => "http://www.mflow.com",
      :timeout_in_second => 240

  end

  before(:each) do
    @selenium_driver.start_new_browser_session
  end

  append_after(:each) do
    @selenium_driver.close_current_browser_session
    @verification_errors.should == []
  end

  it "Renders correctely" do
   
    begin
      page.open "/"
    rescue
      page.wait_for_page_to_load "30000"
    end
    page.is_text_present("DDN Ltd 2010 All rights reserved.").should be_true
   
  end
 

end


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.


Linh Vu

unread,
Sep 14, 2010, 11:09:22 PM9/14/10
to seleniu...@googlegroups.com
You try to config proxy on your PC
when display message with code 404
--
Mr. VuThe Linh
eXo Platform SEA
8 Flr, Thaiha building, 18/11 alley, Thaiha Str, Hanoi
Skype: vu.the.linh
website:www.exoplatform.com
Phone : +84 984 303 104

Arihan

unread,
Sep 15, 2010, 4:15:38 AM9/15/10
to arihan sinha, seleniu...@googlegroups.com
Any workaround to this pls .. 

Regards
Arihan
Sent from my iPhone

sanjeev mathur

unread,
Sep 15, 2010, 5:23:39 AM9/15/10
to seleniu...@googlegroups.com
Try this


it "Renders correctely" do
  
    begin
    page.open "/Account/LogOnwhich"
    raise "Page 404 not found" if @selenium_driver.is_element_present "//div[@id='content']/div/fieldset/h2" == true
    rescue
      puts "An error occured #{$!}"
      page.open "/"

    end
    page.is_text_present("DDN Ltd 2010 All rights reserved.").should be_true
  
  end

dheeraj bharti

unread,
Sep 17, 2010, 10:28:22 AM9/17/10
to seleniu...@googlegroups.com
Oye try giving an extra parameter as true, when you open any browser. i am using in python as
 

def

setUp(self):

self.verificationErrors = []

self.selenium = selenium(

"localhost"
, 4444, "*firefox", "http://127.0.0.1:8000")

self.selenium.start()

def test_testname(self)

sel.open("/admin","true")

 

Cheers,
DB


 

arihan sinha

unread,
Sep 17, 2010, 1:56:52 PM9/17/10
to seleniu...@googlegroups.com
Hi Sanjeev/Dheeraj,

Sanjeev,

As per your suggestion It seems the page navigation first goes to /Account/LogOnWhich and it retrieves to the 404 error code always.
Hence it would come to the main base url www.mflow.com as per resuce part as page.open "/" which again would give the 404 error code because when the home page gets requested , the Account/logOnwhich request goes underneath which retrieves always 404 code. so test would get terminated. If you have tried at your end then please let me know

Dheeraj,

As per your code , you have given extra argument as "true" but I guess open method accepts only one argument. So did you override the open method or what??. As I tried and it gives wrong argument nos. ( 2 for 1)


sel.open("/admin","true")

Cheers
A


sel.open("/admin","true")

Rajat Jindal

unread,
Sep 18, 2010, 5:46:16 AM9/18/10
to Selenium Users
Hi Arihan,

Which language are you using to automate the suite? In Java or .NET,
we cannot pass an extra argument "true". I have fixed this error on my
setup using argument true, but language i am using is Perl which does
accepts another argument.

Now, in .NET or Java, this can be done by encapsulating the open
command in a try catch block, and then parse the exception string to
see if its having XHR error, if yes, then just ignore and continue, if
some other error you may like to terminate your test there.

Pseudo code will look like this:

try {

selenium.open("/URL_TO_BE_OPENED");
}

catch (Exception e) {

if(e.contains("XHR"); //I am not a pure Java guy, sorry !!
{
##Just log the error in log file and do nothing
}else {
Exit;
}
}

Hope it helps.

Thanks
Rajat Jindal
http://www.quicksilver1183.com



On Sep 17, 10:56 pm, arihan sinha <arihan.si...@gmail.com> wrote:
> Hi Sanjeev/Dheeraj,
>
> Sanjeev,
>
> As per your suggestion It seems the page navigation first goes to
> /Account/LogOnWhich and it retrieves to the 404 error code always.
> Hence it would come to the main base urlwww.mflow.comas per resuce part as
> page.open "/" which again would give the 404 error code because when the
> home page gets requested , the Account/logOnwhich request goes underneath
> which retrieves always 404 code. so test would get terminated. If you have
> tried at your end then please let me know
>
> Dheeraj,
>
> As per your code , you have given extra argument as "true" but I guess open
> method accepts only one argument. So did you override the open method or
> what??. As I tried and it gives wrong argument nos. ( 2 for 1)
>
> sel.open(*"/admin"*,*"true"*)
>
> Cheers
> A
>
> sel.open(*"/admin"*,*"true"*)
>
> On Wed, Sep 15, 2010 at 10:23 AM, sanjeev mathur <learnsanj...@gmail.com>wrote:
>
>
>
> > Try this
>
> > it "Renders correctely" do
>
> >     begin
> >     page.open "/Account/LogOnwhich"
> >     raise "Page 404 not found" if @selenium_driver.is_element_present
> > "//div[@id='content']/div/fieldset/h2" == true
> >     rescue
> >       puts "An error occured #{$!}"
> >       page.open "/"
>
> >     end
> >     page.is_text_present("DDN Ltd 2010 All rights reserved.").should
> > be_true
>
> >   end
>
> > On Wed, Sep 15, 2010 at 1:45 PM, Arihan <arihan.si...@gmail.com> wrote:
>
> >>  Any workaround to this pls ..
>
> >> Regards
> >> Arihan
> >> Sent from my iPhone
>
> >> On 14 Sep 2010, at 17:13, arihan sinha <arihan.si...@gmail.com> wrote:
>
> >> I am using selenium+ruby+rspec and below is code which i am using . could
> >> you please let me know where i would put this @Test(skipFailedInvocations =
> >> true)
>
> >> require "rubygems"
> >> gem "rspec"
> >> gem "selenium-client"
> >> require "selenium/client"
> >> require "selenium/rspec/spec_helper"
>
> >> describe "When I go to the HomPage" do
> >>   attr_reader :selenium_driver
> >>   alias :page :selenium_driver
>
> >>   before(:all) do
> >>     @verification_errors = []
> >>     @selenium_driver = Selenium::Client::Driver.new \
> >>       :host => "localhost",
> >>       :port => 4444,
> >>       :browser => "*googlechrome",
> >>       :url => " <http://www.mflow.com>http://www.mflow.com",
> >>       :timeout_in_second => 240
>
> >>   end
>
> >>   before(:each) do
> >>     @selenium_driver.start_new_browser_session
> >>   end
>
> >>   append_after(:each) do
> >>     @selenium_driver.close_current_browser_session
> >>     @verification_errors.should == []
> >>   end
>
> >>   it "Renders correctely" do
>
> >>     begin
> >>       page.open "/"
> >>     rescue
> >>       page.wait_for_page_to_load "30000"
> >>     end
> >>     page.is_text_present("DDN Ltd 2010 All rights reserved.").should
> >> be_true
>
> >>   end
>
> >> end
>
> >> On Tue, Sep 14, 2010 at 4:47 PM, pinglin < <ahryts...@gmail.com>
> >> ahryts...@gmail.com> wrote:
>
> >>>  try  @Test(skipFailedInvocations = true)
>
> >>> On Sep 14, 1:20 pm, arihan sinha <arihan.si...@gmail.com> wrote:
> >>> > I know one solution which would move run my  test like as below
> >>> > begin
> >>> >       page.open "/mflow.public/"
> >>> >     rescue
> >>> >       page.wait_for_page_to_load "30000"
> >>> >     end
>
> >>> > but I want if any way we can ignore that 404 code for that particualr
> >>> > request
> >>> > as example when we navigate to <http://thewww.mflow.com>
> >>> thewww.mflow.com, one rquest goes to thehttp://<http://www.mflow.com/Account/LogOnwhich>
> >>>www.mflow.com/Account/LogOnwhichgives 404 error
>
> >>> > any workaround so that this particular request (/Account/Logon) if
> >>> gives 404
> >>> > error then selenium should ignore that or covert that to status code
> >>> 200 or
> >>> > blocking the request for this url(/Account/Logon) to server so that
> >>> test
> >>> > would move forward without giving exception
>
> >>> > Cheers
> >>> > A
>
> >>> > On Tue, Sep 14, 2010 at 10:45 AM, arihan sinha <arihan.si...@gmail.com
> >>> >wrote:
>
> >>> > > Anyone found any solution for this then pls let me know ??
>
> >>> > > Cheers
> >>> > > A
>
> >>> > > On Mon, Sep 13, 2010 at 6:39 PM, arihan sinha <
> >>> arihan.si...@gmail.com>wrote:
>
> >>> > >> Dear all
>
> >>> > >> in the webpage i am testing ( <http://www.mflow.com>www.mflow.com),
> >>> the page opens fine but in
> >>> > >> the backend one requrest goes to server which retrieves the 404
> >>> error code
> >>> > >> which subsequently terminates the selenium .
> >>> > >> so i am getting the error as
> >>> > >>  "XHR ERROR: URL = <http://www.mflow.com/Response_Code>
> >>>http://www.mflow.com/Response_Code= 404
> >>> > >> Error_Message = Not Found"
> >>> > >> Any workaround pls at selenium end ( not at the code level by
> >>> developers
> >>> > >> :) )
>
> >>> > >> you can try this by just navigating to the home page thorugh
> >>> selenium  (
> >>> > >> <http://www.mflow.com>www.mflow.com)
> >>> > >> I am using selenium+Ruby+Rspec
>
> >>> > >> Regards
> >>> > >> Arihan
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "Selenium Users" group.
> >>> To post to this group, send email to <seleniu...@googlegroups.com>
> >>> seleniu...@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> <selenium-users%2Bunsu...@googlegroups.com>
> >>> selenium-user...@googlegroups.com.
> >>> For more options, visit this group at
> >>> <http://groups.google.com/group/selenium-users?hl=en>
> >>>http://groups.google.com/group/selenium-users?hl=en.
>
> >>  --
> >> You received this message because you are subscribed to the Google Groups
> >> "Selenium Users" group.
> >> To post to this group, send email to seleniu...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> selenium-user...@googlegroups.com<selenium-users%2Bunsubscribe@go oglegroups.com>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/selenium-users?hl=en.
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "Selenium Users" group.
> > To post to this group, send email to seleniu...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > selenium-user...@googlegroups.com<selenium-users%2Bunsubscribe@go oglegroups.com>
> > .

arihan sinha

unread,
Sep 20, 2010, 5:21:17 AM9/20/10
to seleniu...@googlegroups.com
Hi Rajat,

I am using Selenium+ruby+rspec and I am already using this below code which is working ok.

 begin
            page.open "http://www.mflow.com"
      rescue
            page.wait_for_page_to_load "180000"
      end

also i can tweak little bit like what you said but it is more or less same to what I've done before. Actually I was looking if possible can we instruct selenium server not to request to that particular url which cauing the 404 error
   begin
      page.open "http://www.mflow.com/"
       rescue => e
       
        if e.message =~ /XHR/
          puts "ignore 404 error"
         else
          exit
        end
        page.wait_for_page_to_load "180000"
       end

Cheers
A
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.


Rajat Jindal

unread,
Sep 20, 2010, 10:22:40 PM9/20/10
to Selenium Users
Hi Arihan,

I believe there is no such way to tell Selenium not to access a URL
when that URL throws a 404 error [ To check for 404 error again it has
to access it right?], and I am not sure if there is such exception
handling implemented on Selenium side for such a scenario.

Thanks
Rajat Jindal
http://www.quicksilver1183.com

> > > Hence it would come to the main base urlwww.mflow.comasper resuce part
> > > >>>www.mflow.com/Account/LogOnwhichgives404 error
> > > >>> <selenium-users%2Bunsu...@googlegroups.com<selenium-users%252Bunsubscri b...@googlegroups.com>

Shaba K

unread,
Oct 19, 2010, 10:48:37 AM10/19/10
to seleniu...@googlegroups.com
Hi All,
 
Has any one seen this issue & know how to handle this your opinions & ideas counts.

Got result: XHR ERROR: URL = https://<URL>/ Response_Code = -1 Error_Message = Request Error on session b02068efa5ec47349e52da5a953f5933

What does this mean ???

-Shabana

 
 
 


 

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages