Playing with Geb in Groovy Console - groovy

I am learning about GEB and i would like to play around with it in Groovy console. I am tying to run:
import geb.Browser
Browser.drive {
go "http://googel.com/"
assert title == "Google"
}
But this gives an error
unable to resolve class geb.Browser
at line: 1, column: 1
I have downloaded Geb core jar (http://search.maven.org/#artifactdetails%7Corg.codehaus.geb%7Cgeb-core%7C0.7.2%7Cjar) and put it in the PATH, but is not importing in the groovy console. What am i doing wrong and how to run the simple Geb inline scripting?
Thank you
p.s. mac 10.7, geb 0.7.2

Try putting that at the top of your file :
#Grapes([
#Grab("org.codehaus.geb:geb-core:0.7.2"),//always use latest version of geb and selenium drivers
#Grab("org.seleniumhq.selenium:selenium-firefox-driver:2.46.0"),
#Grab("org.seleniumhq.selenium:selenium-support:2.46.0")
])
Then, you won't have to deal with classpath issues and you'll got geb in groovy console easily

Related

Unable to get instance of seleniumLibrary in robotframework

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".

No module names 'notifications.signals'; 'notifications' is not a package

Hello I have a problem with a Django project. When I ran in Pycharm the celery I got this error :
No module named 'notifications.signals'; 'notifications' is not a package
Althought when I type in Python Console this :
from notifications.signals import notify
Could you help me please ?
Thank you very much
If you configure PyCharm to use the same environment that you used when you executed successfully the import statement, then it will all work as expected.

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

Using Pyphen with jython

I am trying to run a Python script from a Java class using jython 2.7.0 and I need to use pyphen as part of the script. The following line in my Python script causes the following error message.
from pyphen import Pyphen
ImportError: No module named pyphen
My question is: Does jython have the capability to use the pyphen module?
And if jython can use the pyphen module, how do get it so jython knows about pyphen?

autodoc on readthedocs and PyQt5

I'm writing a package that wraps PyQt5 functionality and trying to put the documentation on readthedocs. Since PyQt5 is an extension module I mock the module and its classes (manually, because using unittest.mock causes metaclass conflicts):
class PyQt5:
class QtCore:
#staticmethod
def qVersion():
return '5.0.0'
class QObject:
pass
# etc
sys.modules['PyQt5'] = PyQt5
This works fine locally. But although the builds pass without error on readthedocs, there is no autodoc output. What am I missing ?
The project on BitBucket: https://bitbucket.org/fraca7/qtypy/
On ReadTheDocs: https://readthedocs.org/projects/qtypy/
Despite it "passing" the build, if you look carefully at your logs, you will see there are errors like ImportError: No module named 'qtypy' when it starts invoking sphinx.
When I've done this successfully in the past, I've always had a setup.py file at the top level of the repository for installing the package, which I believe is the only way that readthedocs can install the package.
I've then enabled, on readthedocs project admin -> advanced settings,
Install your project inside a virtualenv using setup.py install"
This ensures your module is available to be imported when sphinx runs, so that it can automatically generate the documentation (provided you have successfully mocked PyQt5).

Resources