jnhyperion / HyperRobotFrameworkPlugin

Robot Framework plugin for PyCharm.
30 stars 4 forks source link

Can't found the Library Selenium2Library's keywords' definition #57

Closed DANIKE closed 1 year ago

DANIKE commented 1 year ago

Hi, I new a robot file and add the Selenium2Library Library, but it shows 'keyword definition not found' when I move the mouse over "Click Element" , one of the keyword of Library Selenium2Library. eg: Settings Library Selenium2Library Keywords eg1 Click Element some_element

jnhyperion commented 1 year ago

Make sure you have installed latest robotframework-selenium2library in your current pycharm python interpreter.

DANIKE commented 1 year ago

I have installed robotframework-selenium2library 3.0.0, and it seems the latest version in https://pypi.org/. My computer system is windows. image

jnhyperion commented 1 year ago

did you config your pycharm python interpreter well?

https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html#widget

and make sure your library is installed in the same python with your pycharm if you system has multi python

DANIKE commented 1 year ago

Yes, the config of pycharm python interpreter is right, and the keyword can run corectly. I just can't find the keyword defenition or use Code Completion. But the robot's builtin librarys work well.

jnhyperion commented 1 year ago

I am not able to reproduce your problem.

image

try:

  1. update plugin to latest version
  2. close and reopen pycharm
  3. according to the library intro "Starting from version 3.0, Selenium2Library is renamed to SeleniumLibrary and this project exists mainly to help with transitioning.", using SeleniumLibrary instead
jnhyperion commented 1 year ago

Cannot reproduce, closed.

DANIKE commented 1 year ago

Hi, my robotframework-selenium2library's version is 3.0.0, robotframework-seleniumlibrary's version is 3.2.0,I have tried many times (including upgrade the plugin version and didn't work) and I found the robotframework-seleniumlibrary's version did not have the problem. But our projects use 3.2.0 version for a long time and there is some difference between the two robotframework-seleniumlibrary version. I really want to know the real reason, becase it runs well and it didn't have the problem when using ride. I really like your plugin, so if there is someway to solve the problem, I will very thankful for it.

jnhyperion commented 1 year ago

Thanks for supporting my plugin.

First of all, you need to confirm if the library is correctly imported.

image

then plugin will search the kw definition in pyi file: your_python_interpreter_lib_folder/site-packages/SeleniumLibrary/__init__.pyi, you can check if this file can be found.

DANIKE commented 1 year ago

Thanks, the real reason is there no file:your_python_interpreter_lib_folder/site-packages/SeleniumLibrary/init.pyi. The problem dispeares when I put the file into the path. The init.pyi file starts from robotframework-seleniumlibrary-5.0.0. Because of this, the code_completion function will not work in old versions(<5.0.0). I want to know would you fix this problem and there are must some teams using the old version like us.

jnhyperion commented 1 year ago

I see, pyi file aims to allow any ide plugin to know the functions definition of a python library, because some of the python libraries' functions is dynamically generated in python runtime, SeleniumLibrary is this type of library too.

Without this pyi file, plugin will never know the kw definitions, so, the only way is to upgrade your SeleniumLibrary > 5.0.0.