Getting 404 response on open browser http://www.google.com using Robot Framework using python

1,110 views
Skip to first unread message

AJ

unread,
Nov 1, 2013, 3:04:29 AM11/1/13
to robotframe...@googlegroups.com
Hi All,

Currently I have setup the Robot in my machine as said in the below steps

1. Installed python 2.7.5

2. Added python path to the environment variables.Example: C:\Python27;C:\Python27\Scripts;C:\Python27\DLLs;C:\Python27\Lib;C:\Python27\Lib\lib-tk

3. Installed Robotframework-2.7.7, robotframework_selenium2library-1.4.0, selenium-2.37, decorator-3.4.0-py2.7  using pip

4. then executed the

***  Documentation  ***
test cases to sample
*** Settings ***
Library  Selenium2Library    
*** Testcases ***
Search Should Succeed When Keys are Entered
   Open Browser  http://www.google.com 

Browser is opening successfully and not navigating to the url, But it is failing with the below error

WebDriverException: Message: '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR
/html4/strict.dtd">\r\n<HTML><HEAD><TITLE>Not Found</TITLE>\r\n<META HTTP-EQUIV="Content-Type" Conte
nt="text/html; charset=us-ascii"></HEAD>\r\n<BODY><h2>Not Found</h2>\r\n<hr><p>HTTP Error 404. The r
equested resource is not found.</p>\r\n</BODY></HTML>\r\n'

Tried even with the profile, but didnt help.Kindly help on this :-(.

Thanks

Ajith

Kevin O.

unread,
Nov 1, 2013, 9:45:58 AM11/1/13
to robotframe...@googlegroups.com
I think I have an idea what is causing this, but it would still be helpful if you run at log level debug and attach the log file. You can set the log level by adding these arguments to your command:
--loglevel DEBUG

The page you are being served has language that makes it likely it is being served from an instance of IIS. Selenium is a client/server web application. The webdriver Firefox plugin that is automatically included when launching Firefox is also a web server. It seems like Selenium is trying to talk to that server and hitting an instance of IIS. This may be due to your proxy settings. As webdriver will use the proxy to talk to the local server if they are set. Try disabling all proxy settings to see if that is the problem. If the proxy is the problem and you need to use it there are ways to avoid proxying the traffic between the webdriver client and server - see https://groups.google.com/forum/#!topic/robotframework-users/dwYP_30Dyi4.

AJ

unread,
Nov 3, 2013, 11:11:22 AM11/3/13
to robotframe...@googlegroups.com
Hi Kevin,

Thanks your reply, please find the below log after executing with the debug level. I am really stuck in this. if it is related to configuration and version, kindly guide me.


TEST CASE: Search Should Succeed When Keys are Entered
Full Name: Rfsample.Search Should Succeed When Keys are Entered
Start / End / Elapsed: 20131103 21:31:15.493 / 20131103 21:31:20.924 / 00:00:05.431
Status: FAIL (critical)
Message: WebDriverException: Message: '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">\r\n<HTML><HEAD><TITLE>Not Found</TITLE>\r\n<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>\r\n<BODY><h2>Not Found</h2>\r\n<hr><p>HTTP Error 404. The requested resource is not found.</p>\r\n</BODY></HTML>\r\n'
Expand All KEYWORD: Selenium2Library.Open Browser http://www.google.com
Documentation:

Opens a new browser instance to given URL.

Start / End / Elapsed: 20131103 21:31:15.509 / 20131103 21:31:20.924 / 00:00:05.415
Expand All KEYWORD: Selenium2Library.Capture Page Screenshot
Documentation:

Takes a screenshot of the current page and embeds it into the log.

Start / End / Elapsed: 20131103 21:31:20.909 / 20131103 21:31:20.924 / 00:00:00.015
21:31:20.909 FAIL No browser is open
21:31:20.924 DEBUG Traceback (most recent call last): File "<string>", line 2, in capture_page_screenshot File "C:\Python27\lib\site-packages\Selenium2Library\keywords\keywordgroup.py", line 12, in _run_on_failure_decorator return method(*args, **kwargs) File "C:\Python27\lib\site-packages\Selenium2Library\keywords\_screenshot.py", line 28, in capture_page_screenshot if hasattr(self._current_browser(), 'get_screenshot_as_file'): File "C:\Python27\lib\site-packages\Selenium2Library\keywords\_browsermanagement.py", line 415, in _current_browser raise RuntimeError('No browser is open')
21:31:15.509 INFO Opening browser 'firefox' to base url 'http://www.google.com'
21:31:20.862 DEBUG POST http://127.0.0.1:58001/hub/session {"sessionId": null, "desiredCapabilities": {"platform": "ANY", "browserName": "firefox", "version": "", "javascriptEnabled": true}}
21:31:20.924 WARN Keyword 'Capture Page Screenshot' could not be run on failure: No browser is open
21:31:20.924 FAIL WebDriverException: Message: '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">\r\n<HTML><HEAD><TITLE>Not Found</TITLE>\r\n<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>\r\n<BODY><h2>Not Found</h2>\r\n<hr><p>HTTP Error 404. The requested resource is not found.</p>\r\n</BODY></HTML>\r\n'
21:31:20.924 DEBUG Traceback (most recent call last): File "<string>", line 2, in open_browser File "C:\Python27\lib\site-packages\Selenium2Library\keywords\keywordgroup.py", line 12, in _run_on_failure_decorator return method(*args, **kwargs) File "C:\Python27\lib\site-packages\Selenium2Library\keywords\_browsermanagement.py", line 111, in open_browser browser = self._make_browser(browser_name,desired_capabilities,ff_profile_dir,remote_url) File "C:\Python27\lib\site-packages\Selenium2Library\keywords\_browsermanagement.py", line 429, in _make_browser browser = creation_func(remote, desired_capabilities, profile_dir) File "C:\Python27\lib\site-packages\Selenium2Library\keywords\_browsermanagement.py", line 445, in _make_ff browser = webdriver.Firefox(firefox_profile=profile) File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 61, in __init__ desired_capabilities=capabilities) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 71, in __init__ self.start_session(desired_capabilities, browser_profile) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 113, in start_session 'desiredCapabilities': desired_capabilities, File "C:\Python27\lib\site-packages\Selenium2Library\webdrivermonkeypatches.py", line 11, in execute result = self._base_execute(driver_command, params) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 164, in execute self.error_handler.check_response(response) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 136, in check_response raise exception_class(value)


Thanks
Ajith

詹青朋

unread,
Nov 3, 2013, 10:49:34 PM11/3/13
to robotframe...@googlegroups.com
Maybe your firefox is using a proxy, and the proxy return a 404 response

在 2013年11月1日星期五UTC+8下午3时04分29秒,AJ写道:

Kevin O.

unread,
Nov 4, 2013, 9:08:51 AM11/4/13
to robotframe...@googlegroups.com
Yes it looks like an issue with a proxy like I first thought. I posted the wrong link in my first reply. See https://groups.google.com/d/msg/robotframework-users/Xhpho8voSLg/ZuzTTlLPvj0J for ways to avoid proxying WebDriver traffic.
Also note there is a Selenium issue entered for the same issue.
Reply all
Reply to author
Forward
0 new messages