2

I'm planning to write some Selenium tests for a symfony driven webpage. The page always requires a login (done with the sfGuard plugin).

The problem I found right after the start is that once Selenium calls ->open('/') symfony sends a HTTP 401 and renders the login page. Technically this is absolutely right, but unfortunately this avoids that any further actions can be tested with these testcases because the 401 breaks Selenium.

Is there a way to keep Selenium running or do I have to add a "backdoor" which avoids that I get any HTTP code != 200 ?

Cheers

pagid
  • 13,559
  • 11
  • 78
  • 104

1 Answers1

1

I'm not 100% sure about the Symfony/sfGuard part of this, but a "401 Unauthorized" often means that you have to authenticate using basic access authentication. In Selenium this can be done by adding username and password to the URL. Firefox has a limit on length and IE has to enable username and password in the URL.

selenium->open('http://username:password@example.com/')

I've found another answer on Stackoverflow on the topic where its answered that basic authentication might not be supported.

Community
  • 1
  • 1
HNygard
  • 4,526
  • 6
  • 32
  • 40