how to hide the output of seleniumbase? #2029
-
i want to hide output of seleniumbase |
Beta Was this translation helpful? Give feedback.
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 = True Example: """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") |
Beta Was this translation helpful? Give feedback.
-
Im using webdriver not pytest. so how can i integrate into my code
|
Beta Was this translation helpful? Give feedback.
-
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 = True Example: """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") |
Beta Was this translation helpful? Give feedback.
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: