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.

Plugin initialization randomly fails

See original GitHub issue

This Plugin loading fails randomly and I am not able to establish a pattern why it is failing. Maybe I am doing something fundementally wrong with my plugin code. By any chance, is there something wrong that I doing with my plugin code?

Steps to reproduce the issue

I have a plugin MyPlugin.py as like so:

from SeleniumLibrary import SeleniumLibrary
from SeleniumLibrary.base import keyword
from SeleniumLibrary.keywords.browsermanagement import BrowserManagementKeywords


class MyPlugin(BrowserManagementKeywords):
    def __init__(self, ctx):
        BrowserManagementKeywords.__init__(self, ctx)
        # Some other init things

    @keyword
    def custom_open_browser(self, url: str, alias: str):
        # Do some Custom logic and the open_browser
        return self.open_browser(url=url, alias=alias, browser="chrome")

And this is what my robot scripts looks like:

*** Settings ***
Library           SeleniumLibrary    plugins=${CURDIR}/MyPlugin.py

*** Test Cases ***

Scenario: Custom Open Browser
    # Following Keyword is implemented in MyPlugin.py
    Custom Open Browser    https://example.com/    example

Error messages and additional information

Error in file '/tmp/tmpagw8aw6l/tests/MyTest.robot' on line 2: Initializing library 'SeleniumLibrary' with arguments [ plugins=/tmp/tmpagw8aw6l/tests/MyPlugin.py ] failed: AttributeError: 'NoneType' object has no attribute 'info' 

Traceback (most recent call last): 

File "/usr/local/lib/python3.9/site-packages/SeleniumLibrary/__init__.py", line 484, 
    in __init__ plugin_libs = self._parse_plugins(plugins) 
File "/usr/local/lib/python3.9/site-packages/SeleniumLibrary/__init__.py", line 605, 
    in _parse_plugins plugin = importer.import_class_or_module(parsed_plugin.module) 
File "/usr/local/lib/python3.9/site-packages/robot/utils/importer.py", line 93, 
    in import_class_or_module imported, source = self._import_class_or_module(name_or_path) 
File "/usr/local/lib/python3.9/site-packages/robot/utils/importer.py", line 104, 
    in _import_class_or_module return importer.import_(name) 
File "/usr/local/lib/python3.9/site-packages/robot/utils/importer.py", line 265, 
    in import_ self._remove_wrong_module_from_sys_modules(path) 
File "/usr/local/lib/python3.9/site-packages/robot/utils/importer.py", line 283, 
    in _remove_wrong_module_from_sys_modules self._logger.info("Removed module '%s' from sys.modules to import "

Expected behavior and actual behavior

I expect it to open a browser

Environment

Browser: chrome Browser driver: chromedriver Operating System: Ubuntu 20.04

Libraries: robotframework = “^4.1.1” robotframework-seleniumlibrary = “^6.0.0”

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
rasjanicommented, Feb 28, 2022

Didn’t check but one scenario where this can happen is if there are multiple test suites with different parameters - something similar to this can happen. Afaik, RF does not reinit the already existing library and thus stuff like this can happen.

1reaction
emanlovecommented, Feb 23, 2022

Also the latest version of the core is 4.1.3. With the dot release of .3 I would probably update that from ending .1 to the latest. I haven’t checked the release notes but those point release are generally bug fixes so useful to try out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

in_tail plugin randomly fails with "too many open files ... - GitHub
Bug Report. Describe the bug in_tail plugin randomly fails with "too many open files" and errno=24 - unless switched from inotify to stat...
Read more >
A Unity Plugin fails randomly. I'm out of ideas... - Unity Answers
I am currently working on a team project at university (without software version control system for several reasons) that amongst many other things...
Read more >
Web requests fails with error; "getrandom() initialization failed"
I've noticed that some of our Raspberries running Octoprint have issues sending web request. It often returns " getrandom() initialization ...
Read more >
Error in minecraft plugin development: Is it up to date ...
The error says that you're trying to initialize or enable a plugin that is already enabled. If you have any plugin that enables/disables ......
Read more >
Common issues - 360Works Product Documentation Wiki
Upon first initialization, the plugins will download support files that are necessary for operation. If this process fails for whatever reason ( ...
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