robotframework / SeleniumLibrary

Web testing library for Robot Framework
Apache License 2.0
1.4k stars 765 forks source link

Command line server for the IE driver has stopped working (upgrading to 3.6 from 3.4) using Open Browser. it works using Create Webdriver #960

Closed andreabisello closed 7 years ago

andreabisello commented 7 years ago

Initially i opened the bug report on SeleniumHQ because i thought the crash was related to the driver, but now i moved here becase i think the crash is related to seleniumlibrary.

You can take a look at this bug report https://github.com/SeleniumHQ/selenium/issues/4901 for the screenshot and all software version, anyway with this test case

*** Settings ***
Library                  SeleniumLibrary     15    15

*** Test Cases ***
CrashTest
    Open Browser            https://www.google.com              ie

you obtain a crash, but splitting Open Browser in Create Webdriver and then Go To, it works

CrashTest
        Create Webdriver                Ie
    Go To                           https://www.google.com
aaltat commented 7 years ago

Could you provide more details?

andreabisello commented 7 years ago

system :

OS: Microsoft Windows 10 Pro 10.0.15063 build 15063 Selenium Version: robotframework (3.0.2) robotframework-ftplibrary (1.4) robotframework-requests (0.4.7) robotframework-selenium2library (1.8.0) robotframework-seleniumlibrary (3.0.0b1) robotframework-SikuliLibrary (0.1.5) image

i'm using this

image instead of this

image

i changed Open Browser with Create Webdriver to obtain Ie log like descripted here and making this i understand that with Create Webdriver it works.

how i can take logs using Open Browser?

aaltat commented 7 years ago

I was interested to see the stack trace on the log.html. One can see it when using --loglevel trace option from command line. Also what is the Selenium version you are using?

andreabisello commented 7 years ago

@aaltat sure. Selenium (3.6.0) I attached the log in the zip file with the test.robot file log.zip .


C:\src\automatictestingtool>robot --loglevel trace test.robot
==============================================================================
Test
==============================================================================
[ WARN ] Keyword 'Capture Page Screenshot' could not be run on failure: No browser is open
CrashTest                                                             | FAIL |
error: [Errno 10054] Connessione in corso interrotta forzatamente dall'host remoto
------------------------------------------------------------------------------
Test                                                                  | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================
Output:  C:\src\automatictestingtool\output.xml
Log:     C:\src\automatictestingtool\log.html
Report:  C:\src\automatictestingtool\report.html

C:\src\automatictestingtool>

[log.zip](https://github.com/robotframework/SeleniumLibrary/files/1398481/log.zip)

image

pekkaklarck commented 7 years ago

I cannot open that zip on mobile. Could you copy the error and traceback here? Could you also translate errors to English?

andreabisello commented 7 years ago

@pekkaklarck sure.

This is output.xml

<?xml version="1.0" encoding="UTF-8"?>
<robot generated="20171019 17:41:49.738" generator="Robot 3.0.2 (Python 2.7.13 on win32)">
<suite source="C:\src\automatictestingtool\test.robot" id="s1" name="Test">
<test id="s1-t1" name="CrashTest">
<kw name="Open Browser" library="SeleniumLibrary">
<doc>Opens a new browser instance to given URL.</doc>
<arguments>
<arg>https://www.google.com</arg>
<arg>Ie</arg>
</arguments>
<msg timestamp="20171019 17:41:49.841" level="TRACE">Arguments: [ 'https://www.google.com' | 'Ie' ]</msg>
<msg timestamp="20171019 17:41:49.841" level="INFO">Opening browser 'Ie' to base url 'https://www.google.com'</msg>
<msg timestamp="20171019 17:41:51.850" level="DEBUG">POST http://127.0.0.1:55462/session {"capabilities": {"alwaysMatch": {}, "firstMatch": [{}]}, "desiredCapabilities": {}}</msg>
<msg timestamp="20171019 17:41:53.666" level="DEBUG">Finished Request</msg>
<msg timestamp="20171019 17:41:53.666" level="DEBUG">POST http://127.0.0.1:55462/session/159f5c4a-d06d-48dc-8d18-b40b35bed775/timeouts {"sessionId": "159f5c4a-d06d-48dc-8d18-b40b35bed775", "script": 15000}</msg>
<kw name="Capture Page Screenshot" library="SeleniumLibrary">
<doc>Takes a screenshot of the current page and embeds it into the log.</doc>
<msg timestamp="20171019 17:42:06.284" level="TRACE">Arguments: [  ]</msg>
<msg timestamp="20171019 17:42:06.287" level="FAIL">No browser is open</msg>
<msg timestamp="20171019 17:42:06.287" level="DEBUG">Traceback (most recent call last):
  File "c:\python27\lib\site-packages\SeleniumLibrary\__init__.py", line 266, in run_keyword
    return DynamicCore.run_keyword(self, name, args, kwargs)
  File "c:\python27\lib\site-packages\SeleniumLibrary\base\robotlibcore.py", line 97, in run_keyword
    return self.keywords[name](*args, **kwargs)
  File "c:\python27\lib\site-packages\SeleniumLibrary\keywords\screenshot.py", line 120, in capture_page_screenshot
    if hasattr(self.browser, 'get_screenshot_as_file'):
  File "c:\python27\lib\site-packages\SeleniumLibrary\base\context.py", line 24, in browser
    return self.ctx._browser
  File "c:\python27\lib\site-packages\SeleniumLibrary\__init__.py", line 288, in _browser
    raise RuntimeError('No browser is open')</msg>
<status status="FAIL" endtime="20171019 17:42:06.287" starttime="20171019 17:42:06.283"></status>
</kw>
<msg timestamp="20171019 17:42:06.287" level="WARN">Keyword 'Capture Page Screenshot' could not be run on failure: No browser is open</msg>
<msg timestamp="20171019 17:42:06.291" level="FAIL">error: [Errno 10054] Connessione in corso interrotta forzatamente dall'host remoto</msg>
<msg timestamp="20171019 17:42:06.291" level="DEBUG">Traceback (most recent call last):
  File "c:\python27\lib\site-packages\SeleniumLibrary\__init__.py", line 266, in run_keyword
    return DynamicCore.run_keyword(self, name, args, kwargs)
  File "c:\python27\lib\site-packages\SeleniumLibrary\base\robotlibcore.py", line 97, in run_keyword
    return self.keywords[name](*args, **kwargs)
  File "c:\python27\lib\site-packages\SeleniumLibrary\keywords\browsermanagement.py", line 138, in open_browser
    ff_profile_dir, remote_url)
  File "c:\python27\lib\site-packages\SeleniumLibrary\keywords\browsermanagement.py", line 597, in _make_browser
    browser.set_script_timeout(self.ctx._timeout_in_secs)
  File "c:\python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 796, in set_script_timeout
    'script': int(float(time_to_wait) * 1000)})
  File "c:\python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 306, in execute
    response = self.command_executor.execute(driver_command, params)
  File "c:\python27\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 464, in execute
    return self._request(command_info[0], url, body=data)
  File "c:\python27\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 526, in _request
    resp = opener.open(request, timeout=self._timeout)
  File "c:\python27\lib\urllib2.py", line 429, in open
    response = self._open(req, data)
  File "c:\python27\lib\urllib2.py", line 447, in _open
    '_open', req)
  File "c:\python27\lib\urllib2.py", line 407, in _call_chain
    result = func(*args)
  File "c:\python27\lib\urllib2.py", line 1228, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "c:\python27\lib\urllib2.py", line 1201, in do_open
    r = h.getresponse(buffering=True)
  File "c:\python27\lib\httplib.py", line 1121, in getresponse
    response.begin()
  File "c:\python27\lib\httplib.py", line 438, in begin
    version, status, reason = self._read_status()
  File "c:\python27\lib\httplib.py", line 394, in _read_status
    line = self.fp.readline(_MAXLINE + 1)
  File "c:\python27\lib\socket.py", line 480, in readline
    data = self._sock.recv(self._rbufsize)</msg>
<status status="FAIL" endtime="20171019 17:42:06.291" starttime="20171019 17:41:49.841"></status>
</kw>
<status status="FAIL" endtime="20171019 17:42:06.292" critical="yes" starttime="20171019 17:41:49.840">error: [Errno 10054] Connessione in corso interrotta forzatamente dall'host remoto</status>
</test>
<status status="FAIL" endtime="20171019 17:42:06.297" starttime="20171019 17:41:49.741"></status>
</suite>
<statistics>
<total>
<stat fail="1" pass="0">Critical Tests</stat>
<stat fail="1" pass="0">All Tests</stat>
</total>
<tag>
</tag>
<suite>
<stat fail="1" id="s1" name="Test" pass="0">Test</stat>
</suite>
</statistics>
<errors>
<msg timestamp="20171019 17:42:06.287" level="WARN">Keyword 'Capture Page Screenshot' could not be run on failure: No browser is open</msg>
</errors>
</robot>

i put here https://codepen.io/anon/pen/QqYJgz/ log.html to be readable

This error message "error: [Errno 10054] Connessione in corso interrotta forzatamente dall'host remoto" means " Running Connection closed by the remote host".

i tried to

aaltat commented 7 years ago

Thank you from the input. I can reproduce the problem, but I think it is a Selenium problem. I will write pure selenium implementation and attach it to the Selenium issue.

aaltat commented 7 years ago

It is a Selenium or an IEDriverServer.exe problem, with IEDriverServer.exe 3.5.0 and 3.6.0 this does not work:

from selenium import webdriver

driver = webdriver.Ie()
driver.set_script_timeout(5.0)
driver.get('https://www.google.fi')
driver.quit()

But same code works with IEDriverServer.exe 3.4.0 it works fine. I will raise an issue the Selenium issue tracker and close this one.

aaltat commented 7 years ago

Commented to the https://github.com/SeleniumHQ/selenium/issues/4901 issue that this looks like a Selenium or IEDriverServer.exe problem. Asked them to reopen the issue and lets follow what happens. But in any case, it is for Selenium maintainers to fix the problem.

pekkaklarck commented 7 years ago

This is clearly an issue in the IEDriverServer.exe. Does it have its own issue tracker?

aaltat commented 7 years ago

The difference, which causes the issue that Open Browser keyword calls the set_script_timeout() method by default. And calling this method causes the problem. The Create Webdriver does not call set_script_timeout() method and therefore the error does not happen.

@pekkaklarck as far I recall Selenium also makes the IE driver (Edge driver is made by Microsoft) and I do not know where that source code lives. But I guess they will point me to the right issue tracker, if it is the wrong one.

pekkaklarck commented 7 years ago

Isn't it kind of a bug that Create Webdriver doesn't call set_scriot_timeout?

aaltat commented 7 years ago

Well, good question. I do not have good opinion on the matter because the I do not use the keyword.

kamlesh-c commented 6 years ago

I am facing same issue My IE version : 11.371.16299.0 Robot Framework 3.0.2 (Python 2.7.13 on win32) IE Driver version : 3.9.0.0 is any workaround for this issue

aaltat commented 6 years ago

Because this is quite old issue and your version are different, then most likely you don't have a same issue.

Could you open a new issue and provide the following details?