mtrubs / intellibot

IntelliJ/PyCharm plugin for Robot Automation Framework
https://github.com/millennialmedia/intellibot/wiki
MIT License
158 stars 109 forks source link

"Keyword definition not found" for SeleniumLibrary in PyCharm #191

Open super-sqa opened 6 years ago

super-sqa commented 6 years ago

I tried several different things including switching interpreter and virtual environments. PyCharm still shows the keywords as undefined. The test runs fine. Also no auto-completion or suggestion when I start to type the keywords.

I am on macOS Sierra

screen shot 2017-10-06 at 4 27 42 pm

screen shot 2017-10-06 at 4 29 39 pm

screen shot 2017-10-06 at 4 30 15 pm

amolagare commented 6 years ago

I have a similar issue on Windows Pycharm. Even if I have installed Intellibot and Selenium Robot Framework as per instructions, I am not able to see the keywords highlighted.

image

image

MbryantAE commented 6 years ago

any solutions? or workarounds? im having the same issue

dwaynep commented 6 years ago

I'm having the same issue. Any resolution?

david-kalman commented 6 years ago

Same issue here with PyCharm 2017.2.4. No issue running the tests. Auto-completion works fine with other libraries (AppiumLibrary, Selenium2Library)

BenZCryptoEngineer commented 6 years ago

I am exactly same issue, I updated the PyCharm to the latest community one 2017.3

mumugoah commented 6 years ago

I'm having the same issue, It works good before

tmhung-nt commented 6 years ago

The plugin does work with selenium2library version 1.8.0, but not with the latest version (seleniumLibrary version 3)

preethiganeshamurthy commented 6 years ago

Did you find a workaround for this issue. Even I am having same issue.

Tajindar commented 6 years ago

Same issue with me

Tajindar commented 6 years ago

Any Solution

max-silent commented 6 years ago

The same for me (PyCharm 2017.3.2 community edition). Reproducible with both Selenium2Library (3.0.0) and SeleniumLibrary (3.0.1). IntelliBot version: 0.10.143.381.

Is there any plans for resolving the issue?

P.S.: According to the following comment - it's not a SeleniumLibrary issue: https://github.com/robotframework/SeleniumLibrary/issues/937#issuecomment-334410728

bigMacGO commented 6 years ago

hey, is any possibility it will be fixed? or any known workarounds?

29er commented 6 years ago

Same here! Please assist.

radezivanovic commented 6 years ago

I had the same issue and I found a workaround for this. The issue seems to be related to the new SeleniumLibrary after all, but everything still works with the legacy Selenium2Library.

You will need to install legacy library and then import it in your project for keyword definitions to be resolved: pip install robotframework-selenium2library==1.8.0

then change in your project: Library SeleniumLibrary

to:

Library Selenium2Library
Another important thing for this to work correctly is to use 32bit PyCharm launcher instead of 64bit one. You can find it here: "C:\Program Files\JetBrains\PyCharm Community Edition 2017.3.3\bin\pycharm.exe" You can create a shortcut to that on your desktop for easier access.

After this all the keywords should be resolved correctly.

You can still use SeleniumLibrary to execute your tests, you just need legacy Selenium2Library import to make your life easier while writing tests.

Hope this helps.

outcatcher commented 6 years ago

The issue is clearly related to the fact that SeleniumLibrary 3+ is dynamic library.

In case of dynamic library, keywords are resolved during test execution (you can compare S2E 1.8 and SE 3+ code). Both this RobotFramework Support plugins work only with static libraries.

If you want to use this plugin together with RF3+ with up to date keyword list, I would recommend you to use workaround (though it's dirty naughty hack), generating static library referencing keywords from dynamic one. So you can use it in your Robot resources or tests.

bartkl commented 6 years ago

@outcatcher I'm not familiar with the technical details of this: is it absolutely impossible to resolve keywords from dynamic libraries? Or is it just very hard, requiring a complete rewrite of the plugin.

And a question relating to your workaround: would inspecting keywords (using Ctrl + Click) work?

outcatcher commented 6 years ago

@bartkl There is nothing impossible πŸ™‚ I don't have enough experience in Java and Idea plugins, but it seems that this plugin uses internal Idea Python plugin / Pycharm resolver, so implementing dynamic library kw resolution requires implementing new resolver.

Using static library workaround you should be able to use all standard features. At least auto-completing (ctrl+Space) and quick documentation (ctrl+mouse hover, ctrl+Q) is working for me. Though I need to search for exact python method in used libraries manually, but it's just an issue of my implementation.

JoelDelumen commented 6 years ago

The solution of radezivanovic works on me.

bawiecek commented 6 years ago

I have exactly the same issue while working on Mac OS. It shows the basic keywords, but not the imported one.

JoelDelumen commented 6 years ago

Have you tried reverting selenium2library to 1.8.0?

On Feb 25, 2018 8:53 PM, "bawiecek" notifications@github.com wrote:

I have exactly the same issue while working on Mac OS. It shows the basic keywords, but not the imported one.

β€” You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/millennialmedia/intellibot/issues/191#issuecomment-368307022, or mute the thread https://github.com/notifications/unsubscribe-auth/AZYbsz6GlVGa_HRHXFDgHx6px44B1p2cks5tYVfUgaJpZM4PxJM_ .

bawiecek commented 6 years ago

I am able to install this package successfully only for python2 (on Mac os using pip). When trying to install it either using pip3 or on virtualenv based on python 3.6, I get VersionConflict:

➜ ~ pip3 install robotframework-selenium2library==1.8.0 Collecting robotframework-selenium2library==1.8.0 Using cached robotframework-selenium2library-1.8.0.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 1, in File "/private/var/folders/7y/qj8sb2gd01j2fl6zvmd3rvxhzty535/T/pip-build-4y5dm35j/robotframework-selenium2library/setup.py", line 7, in from ez_setup import use_setuptools File "/private/var/folders/7y/qj8sb2gd01j2fl6zvmd3rvxhzty535/T/pip-build-4y5dm35j/robotframework-selenium2library/src/ez_setup.py", line 106 except pkg_resources.VersionConflict, e: ^ SyntaxError: invalid syntax

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/7y/qj8sb2gd01j2fl6zvmd3rvxhzty535/T/pip-build-4y5dm35j/robotframework-selenium2library/

niedz., 25 lut 2018 o 16:15 uΕΌytkownik JoelDelumen notifications@github.com napisaΕ‚:

Have you tried reverting selenium2library to 1.8.0?

On Feb 25, 2018 8:53 PM, "bawiecek" notifications@github.com wrote:

I have exactly the same issue while working on Mac OS. It shows the basic keywords, but not the imported one.

β€” You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/millennialmedia/intellibot/issues/191#issuecomment-368307022 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AZYbsz6GlVGa_HRHXFDgHx6px44B1p2cks5tYVfUgaJpZM4PxJM_

.

β€” You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/millennialmedia/intellibot/issues/191#issuecomment-368317251, or mute the thread https://github.com/notifications/unsubscribe-auth/AjAkt8w4L54f4B6pvs3ui10ttxEoYH0Oks5tYXkXgaJpZM4PxJM_ .

nneupane commented 6 years ago

Having same issue on Mac OS Sierra 10.12.6

PyCharm 2017.3.4 (Community Edition) Build #PC-173.4674.37, built on March 6, 2018 JRE: 1.8.0_152-release-1024-b15 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Mac OS X 10.12.6

Library SeleniumLibrary

mithunsureshqa commented 6 years ago

I am getting an error on trying to install robotframework-selenium2library==1.8.0

MAC5PG8W:~ msuresh$ pip install robotframework-selenium2library==1.8.0 Collecting robotframework-selenium2library==1.8.0 Downloading robotframework-selenium2library-1.8.0.tar.gz (118kB) 100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 122kB 1.9MB/s Collecting decorator>=3.3.2 (from robotframework-selenium2library==1.8.0) Downloading decorator-4.2.1-py2.py3-none-any.whl Requirement already satisfied: selenium>=2.32.0 in /usr/local/lib/python2.7/site-packages (from robotframework-selenium2library==1.8.0) Requirement already satisfied: robotframework>=2.6.0 in /usr/local/lib/python2.7/site-packages (from robotframework-selenium2library==1.8.0) Building wheels for collected packages: robotframework-selenium2library Running setup.py bdist_wheel for robotframework-selenium2library ... done Stored in directory: /Users//Library/Caches/pip/wheels/70/59/d6/6f7d6b78b7f01f9284dcfa5dce0229ebcc7e7bb617b31153e9 Successfully built robotframework-selenium2library Installing collected packages: decorator, robotframework-selenium2library Found existing installation: robotframework-selenium2library 3.0.0 Uninstalling robotframework-selenium2library-3.0.0: Exception: Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main status = self.run(options, args) File "/usr/local/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run prefix=options.prefix_path, File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 778, in install requirement.uninstall(auto_confirm=True) File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 754, in uninstall paths_to_remove.remove(auto_confirm) File "/usr/local/lib/python2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove renames(path, new_path) File "/usr/local/lib/python2.7/site-packages/pip/utils/init.py", line 267, in renames shutil.move(old, new) File "/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 317, in move os.unlink(src) OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/site-packages/Selenium2Library/init.py'

bartkl commented 6 years ago

@mithunsureshqa You seem to require super user permissions since you have installed globally. Prefix your call to pip with sudo, so that it will be run as super user. That should make things work.

mithunsureshqa commented 6 years ago

@bartkl thanks. somehow sudo also did not work. I tried to completely uninstall robotframework and reinstall. worked fine.

lkrazy commented 6 years ago

@outcatcher Thanks for your sharing :)

Can you share the guide line to generate static SeleniumLibrary 3.0 library?

outcatcher commented 6 years ago

@lkrazy I would suggest you to use fork by @youwi mentioned in https://github.com/millennialmedia/intellibot/issues/199. It's still workaround, but times better than mine :slightly_smiling_face:

You can download intellibot.jar file from his repository and add it to Pycharm using Install plugin from disk... functionality on Plugins page in Pycharm settings

If you still need static library generator β€” you can use my solution from https://gist.github.com/outcatcher/f11c3a7c70a0a2daa8919df8f075a833

lkrazy commented 6 years ago

@outcatcher thanks for your suggestion :+1:

Developer-Rathod commented 6 years ago

Having same issue

Amy-Azazel commented 6 years ago

I am facing the same issue with python 3.6.5 as interpreter, robot framework 3.0.3, seleniumlibrary 3.1.1 and Pycharm v2018.1.2. The workaround by using Selenium2Library with Python v2.7 does work but after each test-case execution, the IDE needs to be restarted as CTRL + CLICK doesn't work. Request you to fix SeleniumLibrary as I have already made my whole project using this.

outcatcher commented 6 years ago

@Developer-Rathod @Amy-Azazel Have you tried solution from #199 (using https://github.com/youwi/intellibot fork)?

Amy-Azazel commented 6 years ago

@outcatcher I did try this one, however some keywords still do not work like, click link, maximize browser window, etc

outcatcher commented 6 years ago

@Amy-Azazel I had same problem first, but Pycharm restart fixed this in my case

If it still doesn't work β€” maybe "generating static library" solution mentioned in https://github.com/millennialmedia/intellibot/issues/191#issuecomment-381640140 can be useful to you (if you can tolerate such workaround πŸ™‚ )

Amy-Azazel commented 6 years ago

@outcatcher In my case, Pycharm restart did not fix this. Workarounds are tolerable, however I hope they add a permanent fix for this asap. πŸ˜€

outcatcher commented 6 years ago

@Amy-Azazel Maybe @youwi can help you with problem with missing keywords with his fork?

frankvanderkuur commented 6 years ago

For all of you who have this problem, @youwi fixed this in his fork. https://github.com/millennialmedia/intellibot/issues/199

The problem about the missing keywords is also fixed now.

I've tested it with Pycharm 2017.1 and 2018.1 and in both cases it works like a charm. It would be nice if we can merge it into the intellibot repos.

bartkl commented 6 years ago

@frankvanderkuur Don't you mean it works like a Pycharm? Oh man, that's really bad. And in public too. Anyways, that's some great news, thanks for sharing, and impressive work @youwi, thank you!

nithinvargheese commented 6 years ago

Hello... I still have issues in getting this correctly. I have installed the new Intellibot plugin. But still 'open browser' command shows 'keyword definition not found'.

PyCharm version : 2018.1.4 (Community Edition) Windows 10 screenshot_1

Can somebody help?

frankvanderkuur commented 6 years ago

Hi Nithinvargheese, try installing en using de SeleniumLibrary instead of the Selenium2Library. I'll think that does the trick.

nithinvargheese commented 6 years ago

How can I get that happen?

pip install robotframework-selenium2library==1.8.0 --> is the command?

frankvanderkuur commented 6 years ago

pip install robotframework-seleniumlibrary should do the trick.

nithinvargheese commented 6 years ago

Tried. But same result. The issue exists

image

bartkl commented 6 years ago

@nithinvargheese

  1. This is a long shot since your screenshot does show the Python environment with SeleniumLibrary installed, but you could try to double check if the project interpreter is correctly set. Open Settings, look up your project in the listing and check under Project Interpreter. You should set up the project to point to the correct Python environment here.
  2. When you're desparate, you can always try flushing/resetting things. a. Try the Invalidate Caches / Restart option under the File menu. b. Try to setup a new project and check if (with a new, minimally functional test suite) the problem disappears then. If so, you could work from there.
nithinvargheese commented 6 years ago

@bartkl Thanks for the tips.

Same results again. Tried a new project too. But it does not seem to be working. Adding some screenshots for reference. secondproject image

frankvanderkuur commented 6 years ago

Hey @nithinvargheese

You need to select the Existing Interpreter option and than the correct Python version where you installed the libraries in. If you only have 3.6 that's the correct one, but it could be you need to select 2.7.

nithinvargheese commented 6 years ago

Do you mean I need to install Python 2.7 version?

frankvanderkuur commented 6 years ago

That depends a bit on the robot libraries you want to use, but in most cases you will be able to use Python 3.x. What I mean is that if you have both 3.6 and 2.7 installed, the libraries could be installed in either of them when you are using PIP. If you have only one version of Python installed, just be sure you select the existing interpreter option instead of the new environment option.

nithinvargheese commented 6 years ago

I have deleted all the previous instances of Python from my PC and started from first. Same results.

joe-riley commented 6 years ago

This isn't working for me either using PyCharm Professional 181.5087 and with the following libs: image

I am not using a virtualenv (I would prefer to but the boss man sees no point) and this shouldn't(?) affect this.

joaonc commented 5 years ago

Not sure if this has been brought up before, but there's a version of the plugin that contains the fix for this: Search for IntelliBot @SeleniumLibrary Patched in the plugins repository.

https://plugins.jetbrains.com/plugin/10700-intellibot-seleniumlibrary-patched

I recall seeing the GitHub fork with this fix, but now I can't seem to find it. I hope the author of this fix (Yu Cheng) didn't take it down as this plugin seems to have been abandoned but it's still the best Robot Framework plugin out there (tried a few).

Using PyCharm 2018.2 on Mac.