Unable to get instance of seleniumLibrary in robotframework - python-3.x

I am using robot framework with python. I am trying to get seleniumLibrary instance in python file using following code
from robot.libraries.BuiltIn import BuiltIn
class PythonDemo(object):
def __init__(self):
self.myInstance = BuiltIn().get_library_instance('SeleniumLibrary')
When i try use self.myInstance to populate keywords, its not showing in .py file.
In .robot file, i can easily access robot and seleniumLibrary keywords. But unable to use seleniumLibrary instance in .python file
Below are configuration details-
Pycharm community edition 2020.3
robotframework 3.2.2,
robotframework-pythonlibcore 2.1.0,
robotframework-ride 1.7.4.2,
robotframework-seleniumlibrary 3.3.1,
selenium 4.1.0,
python 3.8.0,
plugin - intellibot#seleniumLibrary Patched.
is there any setting in Pycharm? or am i missing anything?
Could anybody please help me with this issue?
Thanks

Not Possible - you will get RobotNotRunning exception if you just try to acquire "instance" of a library via BuiltIn() if the python code you have is executed directly and not by adding Library YourPythonCodeLib to settings section of the "your_test_or_task.robot".

Related

Attribute error : module "pytest" has no attribute "hookimpl"

I have installed python 3.8.3 in windows 8/64 bit.. I need to start with pytest...path has been set properly... In Pycharm I am getting
Attribute error : module "pytest" has no attribute "hookimpl"
All the plugins installed as per the latest version
Pytest doesn't supports Python 3.8 yet.
Supported versions for Pytest
Python 3.5
Python 3.6
Python 3.7
PyPy3
Create a new virtualenv in Pycharm with these versions. If you don't know how here is a link for you.
Pycharm Configuring Python Interpreter
Also if you are interested you can find more info about Pytest Installation
There appears to be an issue with a Magic String here. Make sure you dont have any file named identically to any internal python code. I changed my package name from 'pytest' to 'pytestdemo' and this error was resolved.
Check your pytest project/package name, it should not start with 'Test'. I got same issue when project/package name was "Test". Changing the project/package name solved the issue.

Unable to import 'scrapy_splash' pylint(import-error)

when trying to import Splash Request in VS Code, I get the following error message:
Unable to import 'scrapy_splash' pylint(import-error)
Do you know why this is the case? I have Splash up and running and the package is installed in my environment. I am using Python 3.7
Here is a screenshoot
Problem solved, I was in the wrong environment. You can change the environment in the command pallete (Ctrl+Shift+P) and enter Python: Select Interpreter

Python GUI Tkinter is not including all libraries or modules to use

I am using Pycharm version: Pycharm Community Edition 2017.1 on Windows 7 64 bit edition, and my environment variables are set as below:
PYTHONPATH: C:\Users\vinsow\AppData\Local\Programs\Python\Python36-32\Lib;C:\Users\vinsow\AppData\Local\Programs\Python\Python36-32\DLLs;C:\Users\vinsow\AppData\Local\Programs\Python\Python36-32\tcl\tk8.6;
PATH: C:\Users\vinsow\AppData\Local\Programs\Python\Python36-32\Scripts\;C:\Users\vinsow\AppData\Local\Programs\Python\Python36-32\;C:\Tcl\bin;C:\Program Files\Java\jdk1.8.0_60\bin;%PATH%
CLASSPATH: C:\Program Files\Java\jdk1.8.0_60\bin;C:\Program Files\Java\jre1.8.0_60\bin;.
When I open a new python file using pycharm and type in:
import tkinter this works
Whereas :
tkinter.[functions popup] would display very few options:
as in image, Looks like I have to update the path variable or either some things to change in my Pycharm IDE. I am a newbie for a tkinter GUI programming.
You have a file named tkinter.py, so it's importing that file rather than the tkinter module. rename tkinter.py to something else.
Childish Mistake.
Your file is named tkinter.py which if you know is the same as the Module tkinter when you type import tkinter.
So What you are doing is;
while 3>2:
os.starfile('/pathtoyourfile')
it is an Infinite Loop going on.
When I was learning python and learning to send emails i named my file email.py and because of that my file was failing try to name you files as adrgdt.py something Unique so you dont run into this error again
I hope this helps.

Name Error: name 'get_ipython' is not defined

I'm trying to run the following few lines with ipython (3.5 version):
import sys
from init_mooc_nb import *
init_notebook()
I would like some help to figure out what is the error (see below).
Thank you in advance.
Complete Error
It is possible that this is part of an ipython notebook and needs to be run in ipython notebook... (use e.g. jupyter notebookor ipython -notebook from command line to start it...)
If you're using Intellij Idea with the Python plugin:
Put your notebooks inside a python package and then right click the package and select Mark directory as -> Load Path Root
There's an open bug on the Intellij idea team here

Why PyCharm can't import Gtk? [duplicate]

I'm using PyCharm 2.5 on Ubuntu 11.10, trying to develop an application using PyGObject 3.0 on Python 3.2.2. I've installed the Ubuntu package python3-gobject, and when I run my code, it works exactly as expected.
However, PyCharm can not seem to find any of the PyGObject modules. It says Unresolved refrence: 'Gtk' when I hover over Gtk in my import statement, and of course none of the auto-completion works.
This is my code:
#!/usr/bin/env python3
from gi.repository import Gtk
win = Gtk.Window()
win.connect("delete-event", Gtk.main_quit)
win.show_all()
Gtk.main()
I've even tried making a python virtual environment and then installing PyGObject from source into it, and then even tried making symlinks from all the .py files in site-packages/gi/overrides to site-packages/gi/repository, all with no luck.
Any advice would be greatly appreciated!
Position the text cursor inside the redlined Gtk in:
from gi.repository import Gtk
hit Alt + Enter and choose "Generate stubs for binary module"
In Gtk+ 3 Python bindings to binary modules are generated dynamically using *.typelib databases. The dynamic importer for accessing all the modules is located in gi.repository. PyCharm cannot detect these modules using its code insight, because they require special handling.
I've filed a feature request for this issue: PY-6932. Feel free to vote for it.

Resources