Skip to content

Pytest-bdd integration with selenium base #1200

Answered by mdmintz
taruntechno asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @taruntechno, when using https://github.com/pytest-dev/pytest-bdd with SeleniumBase, you may need to use the SeleniumBase sb fixture format for compatibility. (Numbers 3 and 4 of syntax_formats)

Here's what the sb fixture format looks like, shown below: (pytest-bdd can be added onto that separately)

# "sb" pytest fixture test in a method with no class
def test_sb_fixture_with_no_class(sb):
    sb.open("https://google.com/ncr")
    sb.type('input[title="Search"]', "SeleniumBase GitHub\n")
    sb.click('a[href*="github.com/seleniumbase/SeleniumBase"]')
    sb.click('a[title="seleniumbase"]')

# "sb" pytest fixture test in a method inside a class
class Test_SB_Fixture:
    def test_sb_fix…

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
7 replies
@taruntechno
Comment options

@mdmintz
Comment options

@taruntechno
Comment options

@mdmintz
Comment options

@taruntechno
Comment options

Answer selected by mdmintz
Comment options

You must be logged in to vote
2 replies
@taruntechno
Comment options

@mdmintz
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants