pytest-selenium icon indicating copy to clipboard operation
pytest-selenium copied to clipboard

extending the pytest-selenium methods?

Open chillum opened this issue 4 years ago • 1 comments

Hi,

I want to extend the pytest-selenium methods, but adding the new method in WebDriver class somehow doesn't work and still reports AttributeError: 'WebDriver' object has no attribute 'wait'.

I've tried to add the code in fixture override (as per docs) and just in my code.

I'm actually trying to add a method like this:

class WebDriver:
    def wait(self, func):
        WebDriverWait(self, timeout=10).until(func)

so I can use something like:

def test_something(selenium):
    selenium.find_element_by_id('navigation').click()
    selenium.wait(lambda s: s.find_element_by_link_text('Upload data').click())

Any advice for accomplishing this? Thanks

chillum avatar Sep 26 '21 16:09 chillum

I think a better place to ask a question like this would be stack overflow.

If you look at the documentation it should be clear.

In pytest-selenium driver is selenium ;)

dosas avatar Dec 01 '21 20:12 dosas