how to hide the output of seleniumbase? #2029
Answered
by
mdmintz
Sytehel-1337
asked this question in
Q&A
|
i want to hide output of seleniumbase |
Answered by
mdmintz
Aug 25, 2023
Replies: 3 comments 2 replies
|
Currently, to hide output like that, you can run tests using pytest multithreaded-mode. Eg. It's also possible that a future release of SeleniumBase will add an option to hide the output of installing drivers directly. Update: This feature was added in SeleniumBase Here's a way to make tests download drivers silently: (if a driver download is needed) from seleniumbase.config import settings
settings.HIDE_DRIVER_DOWNLOADS = TrueExample: """Context Manager Test. Runs with "python". (pytest not needed)."""
from seleniumbase import SB
from seleniumbase.config import settings
settings.HIDE_DRIVER_DOWNLOADS = True
with SB() as sb: # By default, browser="chrome" if not set.
sb.open("https://seleniumbase.io/realworld/login")
sb.type("#username", "demo_user")
sb.type("#password", "secret_pass")
sb.enter_mfa_code("#totpcode", "GAXG2MTEOR3DMMDG") # 6-digit
sb.assert_text("Welcome!", "h1")
sb.highlight("img#image1") # A fancier assert_element() call
sb.click('a:contains("This Page")') # Use :contains() on any tag
sb.click_link("Sign out") # Link must be "a" tag. Not "button".
sb.assert_element('a:contains("Sign in")')
sb.assert_exact_text("You have been signed out!", "#top_message") |
2 replies
Answer selected by
mdmintz
|
Im using webdriver not pytest. so how can i integrate into my code |
0 replies
|
This feature was added in SeleniumBase Here's a way to make tests download drivers silently: (if a driver download is needed) from seleniumbase.config import settings
settings.HIDE_DRIVER_DOWNLOADS = TrueExample: """Context Manager Test. Runs with "python". (pytest not needed)."""
from seleniumbase import SB
from seleniumbase.config import settings
settings.HIDE_DRIVER_DOWNLOADS = True
with SB() as sb: # By default, browser="chrome" if not set.
sb.open("https://seleniumbase.io/realworld/login")
sb.type("#username", "demo_user")
sb.type("#password", "secret_pass")
sb.enter_mfa_code("#totpcode", "GAXG2MTEOR3DMMDG") # 6-digit
sb.assert_text("Welcome!", "h1")
sb.highlight("img#image1") # A fancier assert_element() call
sb.click('a:contains("This Page")') # Use :contains() on any tag
sb.click_link("Sign out") # Link must be "a" tag. Not "button".
sb.assert_element('a:contains("Sign in")')
sb.assert_exact_text("You have been signed out!", "#top_message") |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Currently, to hide output like that, you can run tests using pytest multithreaded-mode.
Eg.
pytest -n1(For one thread, but hides output)It's also possible that a future release of SeleniumBase will add an option to hide the output of installing drivers directly.
Update:
This feature was added in SeleniumBase
4.17.12:Here's a way to make tests download drivers silently: (if a driver download is needed)
Example: