Skip to content

The Wait Until * keywords don't support a None value for the error parameter #1733

@tminakov

Description

@tminakov

Steps to reproduce the issue

*** Settings ***
Library     SeleniumLibrary

*** Test Cases ***
Test
    Open Browser  url=https://github.com/  browser=Chrome

    Run Keyword And Expect Error        Element * not visible after *
            ...     Wait Until Element Is Visible    locator=xpath://div[@id="nosuchelement"]   timeout=200 milliseconds 

    # the previous call passes, the following - not:

    Run Keyword And Expect Error        Element * not visible after *
            ...     Wait Until Element Is Visible    locator=xpath://div[@id="nosuchelement"]   timeout=200 milliseconds     error=${None}
    # the failure is
    # Expected error 'Element * not visible after *' but got 'None'.

    [Teardown]      Close Browser

Error messages and additional information

The issue is applicable to all wait_until_*() methods in the keywords\waiting.py file; apparently the type hinting makes Robot Framework itself to cast the value to str - once the value is passed as a method argument, it's already a string.

Expected behavior and actual behavior

Passing a ${None} argument to error should be equivalent as not setting a value at all, leaving it to default. But it's actually substituted with the string representation, e.g. "None"

Attempted workarounds

Changing the hint to Union[str, None], Union[None, str] - no luck, still the same unexpected behavior.

Environment

Browser: Not important (reproduced with Chrome v91.0.4472.77)
Browser driver: Not important (reproduced with chromedriver v91.0.4472.19)
Operating System: Win 10, AWS Linux, Ubuntu 18.04
Libraries

  • Robot Framework: 4.0.3
  • Selenium: 3.141.0
  • SeleniumLibrary: 5.1.3
  • Interpreter: py3.7.8

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions