Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

To capture screenshot ,with desktop library mss, pyautogui is my requirement , when multithreading with pytest-xdist in UC mode #2469

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

I need a help , when multithreading with pytest-xdist , I need to capture the screenshot. In that case multiple chrome windows are opened , I need to capture screenshot of every window separately. How to achieve the scenario

Exactly , Is there any way to pass driver.window_handles to above libraries to capture screen ?
It is also to consider we are in UC mode and in multithreading.

In multithreading every driver is a different instance I think ,then How to handle multiple windows?

Please share your idea.
Is there any special libraries available to achieve capturing screenshot from desktop with the help of seleniumbase ?
Or seleniumbase is itself has any api to achieve it ?
Or Is there any reference for opened windows in multithreading which shall be passed to libraries to take screenshot?

Library mss, pyautogui ,I prefer for capturing screenshot

You may be advice to take screenshot with seleniumbase(Browser Screenshot) , but My scenario is to capture screenshot from desktop (My screenshot should include all data from desktop too ,that why I am going for it)

Thanks for reading, Is any ides please share with me

You must be logged in to vote

These are the SeleniumBase methods available for saving a screenshot during tests:

self.save_screenshot(name, folder=None, selector=None, by="css selector")
self.save_screenshot_to_logs(name=None, selector=None, by="css selector")
self.save_element_as_image_file(selector, file_name, folder=None, overlay_text="")

There are example tests that use those, such as SeleniumBase/examples/test_save_screenshots.py.

Tests also automatically save a screenshot on failure to the ./latest_logs folder.

You can also have all tests save a screenshot at the end with this pytest command-line option: --screenshot.

For questions related to other repos, (such as pyautogui), please see those respective repos,...

Replies: 1 comment 3 replies

Comment options

These are the SeleniumBase methods available for saving a screenshot during tests:

self.save_screenshot(name, folder=None, selector=None, by="css selector")
self.save_screenshot_to_logs(name=None, selector=None, by="css selector")
self.save_element_as_image_file(selector, file_name, folder=None, overlay_text="")

There are example tests that use those, such as SeleniumBase/examples/test_save_screenshots.py.

Tests also automatically save a screenshot on failure to the ./latest_logs folder.

You can also have all tests save a screenshot at the end with this pytest command-line option: --screenshot.

For questions related to other repos, (such as pyautogui), please see those respective repos, or ask on StackOverflow.

You must be logged in to vote
3 replies
Comment options

Ok, Thanks for reply

Comment options

Is there a way to take full screenshot

Comment options

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

AltStyle によって変換されたページ (->オリジナル) /