Hi Mr Mintz,
I am really surprised by the kind of work you put in seleniumbase.
Just started using this , but is there a way to use this in Behave(BDD) as the step functions don't work with classes and I don't see a way to use BaseCase from a normal function.
Appreciate your help.
Hi Sri,
Thank you. There's a special format for using SeleniumBase without BaseCase. This is done by using SeleniumBase as a pytest fixture. Here's an example of that: github.com/seleniumbase/SeleniumBa...
This format may be needed when using other pytest fixtures in your tests.
# "sb" pytest fixture test in a method with no class
deftest_sb_fixture_with_no_class(sb):sb.open("https://google.com/ncr")sb.type('input[title="Search"]','SeleniumBase\n')sb.click('a[href*="github.com/seleniumbase/SeleniumBase"]')sb.click('a[title="seleniumbase"]')# "sb" pytest fixture test in a method inside a class
classTest_SB_Fixture():deftest_sb_fixture_inside_class(self,sb):sb.open("https://google.com/ncr")sb.type('input[title="Search"]','SeleniumBase\n')sb.click('a[href*="github.com/seleniumbase/SeleniumBase"]')sb.click('a[title="examples"]')
Sorry for the trouble as I am completely new to behave.
what is "sb" ? Is it an object of some class that needs to eb instantiated in some fixture definition ?
Help appreciated.
You're probably looking for stackoverflow.com/a/41151454 , which explains pytest vs behave and has a link to pytest-bdd.
sb is the pytest fixture for SeleniumBase. Using SeleniumBase-as-a-fixture gives you the compatibility that you need to use pytest-bdd fixtures in your code at the same time, such as scenario, given, when, and then. Details on pytest-bdd can be found here: pypi.org/project/pytest-bdd/ . That is completely separate from SeleniumBase, but pytest does allow for the use of multiple fixtures at the same time.
Hey man thanks for sharing. Huge fan of SeleniumBase here. I am happy to hear that Edge people is making an effort for those who have been in Selenium 3 for a while.
Hi Mr Mintz,
I am really surprised by the kind of work you put in seleniumbase.
Just started using this , but is there a way to use this in Behave(BDD) as the step functions don't work with classes and I don't see a way to use BaseCase from a normal function.
Appreciate your help.
Thanks
Sri
Hi Sri,
Thank you. There's a special format for using SeleniumBase without BaseCase. This is done by using SeleniumBase as a pytest fixture. Here's an example of that:
github.com/seleniumbase/SeleniumBa...
This format may be needed when using other pytest fixtures in your tests.
Thanks, Let me try and update you.
Sorry for the trouble as I am completely new to behave.
what is "sb" ? Is it an object of some class that needs to eb instantiated in some fixture definition ?
Help appreciated.
Thanks
Sri
You're probably looking for stackoverflow.com/a/41151454 , which explains
pytestvsbehaveand has a link topytest-bdd.sbis the pytest fixture for SeleniumBase. Using SeleniumBase-as-a-fixture gives you the compatibility that you need to usepytest-bddfixtures in your code at the same time, such asscenario,given,when, andthen. Details onpytest-bddcan be found here: pypi.org/project/pytest-bdd/ . That is completely separate from SeleniumBase, but pytest does allow for the use of multiple fixtures at the same time.Thanks for the quick response. I will try.
Hey man thanks for sharing. Huge fan of SeleniumBase here. I am happy to hear that Edge people is making an effort for those who have been in Selenium 3 for a while.
Keep the posts coming.
Thank you for the kind words. I'll keep the posts coming. :)