Skip to content

'Handle Alert' keyword treats all exceptions as timeout #1500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Zeckie opened this issue Oct 28, 2019 · 3 comments
Closed

'Handle Alert' keyword treats all exceptions as timeout #1500

Zeckie opened this issue Oct 28, 2019 · 3 comments
Labels
Milestone

Comments

@Zeckie
Copy link
Contributor

Zeckie commented Oct 28, 2019

Steps to reproduce the issue

If the browser crashes or the window is closed the keyword 'Handle Alert' is waiting for an alert to appear, the error "Alert not found in (time)" is raised, where (time) is the timeout configured, but not reached. For example, if timeout is 2 minutes the error shows as Alert not found in 2 minutes. despite the keyword failing after only a few seconds.

I've created a demo at: https://github.com/Zeckie/AlertBug/tree/master/RobotProject

Error messages and additional information

From test DelayedClose (source https://github.com/Zeckie/AlertBug/blob/master/RobotProject/Alerts.robot)

Alert not found in 2 minutes. 
Traceback (most recent call last):
  File "C:\Users\Zeckie\AppData\Local\Programs\Python\Python37\Lib\site-packages\SeleniumLibrary\__init__.py", line 467, in run_keyword
    return DynamicCore.run_keyword(self, name, args, kwargs)
  File "C:\Users\Zeckie\AppData\Local\Programs\Python\Python37\Lib\site-packages\SeleniumLibrary\base\robotlibcore.py", line 102, in run_keyword
    return self.keywords[name](*args, **kwargs)
  File "C:\Users\Zeckie\AppData\Local\Programs\Python\Python37\Lib\site-packages\SeleniumLibrary\keywords\alert.py", line 117, in handle_alert
    alert = self._wait_alert(timeout)
  File "C:\Users\Zeckie\AppData\Local\Programs\Python\Python37\Lib\site-packages\SeleniumLibrary\keywords\alert.py", line 138, in _wait_alert
    % secs_to_timestr(timeout)) 

Expected behavior and actual behavior

I expect the test to fail, but for the error message to not be misleading. Ie. it should say that the window was closed (or that it couldn't communicate with the browser).

Environment

Browser: Chrome 78
Browser driver: chromedriver 77
Operating System: Windows 10
Eclipse: 2019-09
Libraries

  • Robot Framework: 3.1.2
  • Selenium: 3.141.0
  • SeleniumLibrary: 4.1.0
  • Interpreter: Python 3.7.4

I'm working on a fix - will submit a pull request soon.

Zeckie added a commit to Zeckie/SeleniumLibrary that referenced this issue Oct 28, 2019
Raise the current exception only for TimeoutException and add new except block for WebDriverException.
robotframework#1500
@aaltat
Copy link
Contributor

aaltat commented Oct 28, 2019

I think I understand what you are saying, but I need to also see the results from your examples. I will try to find time to do it, when I have reviewed #1497

@aaltat
Copy link
Contributor

aaltat commented Oct 29, 2019

After reading your PR, I see the reason. This is good idea to do and PR is almost ready.

@aaltat aaltat added the acknowledge To be acknowledged in release notes label Nov 2, 2019
aaltat pushed a commit that referenced this issue Nov 2, 2019
Raise the current exception only for TimeoutException and add new except block for WebDriverException.
#1500
@aaltat
Copy link
Contributor

aaltat commented Nov 2, 2019

Fixed in #1501

@aaltat aaltat closed this as completed Nov 2, 2019
@aaltat aaltat added the rc 1 label Jan 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants