Comments (5)
This wouldn't be hard, and I've thought about doing it, but it would add
complexity to the code and part of the goal is to keep this package as
simple as possible. I doubt I'll do it, but I'll give it some thought.
Perhaps I could create a base class that doesn't use robot, and then
inherit from that to create one that uses robot.
On Fri, Jul 1, 2016 at 2:46 AM, Ramakrishnan [email protected]
wrote:
Thank you for the package.
I would like to request please if we could have the package be used
independent of robotframework. Currently I understood that se2lib instance
is based onBuiltIn().get_library_instance("Selenium2Library")
If the instance se2lib, could be created universally, without using the
method of BuiltIn that gets an existing instance, then the package could
also be used with other test-framework also. I would like to request if we
could have the enhancement and if its practical—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/boakley/robotframework-pageobjectlibrary/issues/4,
or mute the thread
https://github.com/notifications/unsubscribe/ABEmYla3z35ap5ea3-GeBIHKZUucqPpcks5qRMXWgaJpZM4JC5eS
.
from robotframework-pageobjectlibrary.
Thank you, if its possible to simply control using an argument to existing PageObject on using other test framework, I will find it useful
pageobject.py
.
.
.
from robot.utils.connectioncache import ConnectionCache
import Selenium2Library
# These two lines needs to be executed only once
cache_sel2lib = ConnectionCache()
cache_sel2lib.register (Selenium2Library.Selenium2Library(), alias='page_instance')
.
.
.
Class PageObject(six.with_metaclass(ABCMeta, object)):
def __init__(self, robot_running=True):
self.logger = robot.api.logger
self.locator = LocatorMap(getattr(self, "_locators", {}))
self.robot_running = robot_running
# N.B. se2lib, browser use @property so that a
# subclass can be instantiated outside of the context of a running
# test (eg: by libdoc, robotframework-hub, etc)
@property
def se2lib(self):
if self.robot_running:
return BuiltIn().get_library_instance("Selenium2Library")
else:
global cache_sel2lib
return cache_sel2lib.get_connection('page_instance')
example:
If the argument robot_running is False, then Selenium2Library instance is returned else, the Selenium2Library instance using method of BuiltIn is returned
from robotframework-pageobjectlibrary.
Why would you use Selenium2Library without robot framework? Is that even
possible? I think Selenium2Library requires robot. I was thinking you
wanted to use it without robot at all, meaning without Selenium2Library.
On Fri, Jul 1, 2016 at 12:14 PM, Ramakrishnan [email protected]
wrote:
Thank you, if its possible to simply control using an argument to existing
PageObject on using other test framework, I will find it usefulfrom robot.utils.connectioncache import ConnectionCache
import Selenium2LibraryThis three lines needs to be executed only once
cache_sel2lib = ConnectionCache()
cache_sel2lib.register (Selenium2Library.Selenium2Library(), alias='page_instance')Class PageObject(six.with_metaclass(ABCMeta, object)):
def __init__(self, robot_running=True): self.logger = robot.api.logger self.locator = LocatorMap(getattr(self, "_locators", {})) self.robot_running = robot_running # N.B. se2lib, browser use @property so that a # subclass can be instantiated outside of the context of a running # test (eg: by libdoc, robotframework-hub, etc) @property def se2lib(self): if robot_running: return BuiltIn().get_library_instance("Selenium2Library") else: global cache_sel2lib return cache_sel2lib.get_connection('page_instance')
example:
If the argument robot_running is False, then Selenium2Library instance is
returned else, the Selenium2Library instance using method of BuiltIn is
returned—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/boakley/robotframework-pageobjectlibrary/issues/4#issuecomment-230000508,
or mute the thread
https://github.com/notifications/unsubscribe/ABEmYp5YyPMRLbON9IIfKMS5z51bsE8sks5qRUragaJpZM4JC5eS
.
from robotframework-pageobjectlibrary.
yes, Selenium2Library requires robot package as a 'dependency'. However, I could always create script that would import Selenium2Library but could be executed using any python test-framework and not necessarily robot framework. It gives an alternative. It also asserts that the library is independent though it could be using the utilities or api of robot package
from robotframework-pageobjectlibrary.
I'm not going to implement this. I don't see any value. This library is so small, if you need to use it with some other testing framework, it would be easy to fork and make the necessary changes.
You could do this now by simply creating a new subclass and overriding the se2lib
property.
from robotframework-pageobjectlibrary.
Related Issues (19)
- First Feedback HOT 2
- Updates for new versions of SeleniumLibrary HOT 1
- Dynamic elements in locators? HOT 2
- Error while importing module six
- Installation issue with Python 3.6 HOT 4
- Failed when keyword conflicts in two files HOT 3
- Problem with setting library search order
- Localization Support
- Webdriver didn't get website with document.readyState == 'complete' HOT 3
- Init method of user class execute few times
- wait_for_page_refresh, "timeout" parameter not taken into account by the wait_for_condition function
- Need to implement Inheritance using PageObject library HOT 4
- User defined inheritance using Page Object Library HOT 1
- Argument check probably wrong
- Page Object and robotframework-browser (playwright)?
- Test Setup broken HOT 5
- Page objects with extended Selenium2Library HOT 3
- How to do when lots of page objects are in different directories? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from robotframework-pageobjectlibrary.