Git Product home page Git Product logo

Comments (5)

boakley avatar boakley commented on August 19, 2024

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 on

BuiltIn().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.

SteveHarrison82 avatar SteveHarrison82 commented on August 19, 2024

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.

boakley avatar boakley commented on August 19, 2024

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 useful

from robot.utils.connectioncache import ConnectionCache
import Selenium2Library

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

SteveHarrison82 avatar SteveHarrison82 commented on August 19, 2024

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.

boakley avatar boakley commented on August 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.