question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
pekkaklarckcommented, Jun 11, 2021

If type is Union[str, None], string None isn’t converted because the type allows strings.

1reaction
aaltatcommented, Jun 10, 2021

I can take a look, most likely this week.

Read more comments on GitHub >

github_iconTop Results From Across the Web

RF version 4 and above:Suspended due to logged failure ...
In RF version 4 and above, I am getting exception when using "Wait Until Page ... Argument 'timeout' got value '0.5s' that cannot...
Read more >
"Wait Until Keyword Succeeds" doesn't execute the whole ...
In case there is an issue with the read text, I used a simple string. Only 'Robot is nor working' appears on the...
Read more >
BuiltIn - Robot Framework
Keywords verifying something that allow dropping actual and expected values from the possible error message also consider string no values to be ...
Read more >
argparse — Parser for command-line options, arguments and ...
The module will also issue errors when users give the program invalid ... It supports positional arguments, options that accept values, and on/off...
Read more >
KEYWORDS — robotframework-jupyterlibrary 0.4.1 ...
timeout : Default value for timeouts used with Wait ... keywords. ... See Selenium API documentation for details about the supported arguments. Examples: ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found