mirror of
https://github.com/konpa/devicon.git
synced 2025-08-12 09:34:36 +02:00
Script checks for visibility before screenshotting (#829)
Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com>
This commit is contained in:
@@ -86,15 +86,18 @@ class PeekSeleniumRunner(SeleniumRunner):
|
|||||||
main_content.screenshot(new_icons_path);
|
main_content.screenshot(new_icons_path);
|
||||||
|
|
||||||
# go downward so we get the oldest icon first
|
# go downward so we get the oldest icon first
|
||||||
len_ = len(svgs)
|
icon_divs_xpath = f'//div[@id="glyphSet0"]/div'
|
||||||
for i in range(len_, 0, -1):
|
icon_divs = self.driver.find_elements_by_xpath(icon_divs_xpath)
|
||||||
xpath = f'//*[@id="glyphSet0"]/div[{i}]'
|
icon_divs.reverse()
|
||||||
icon_div = self.driver.find_element_by_xpath(xpath)
|
i = 0
|
||||||
|
for icon_div in icon_divs:
|
||||||
|
if not icon_div.is_displayed():
|
||||||
|
continue
|
||||||
|
|
||||||
# crop the div out from the screenshot
|
|
||||||
icon_screenshot = str(
|
icon_screenshot = str(
|
||||||
Path(screenshot_folder, f"new_icon_{len_ - i}.png").resolve()
|
Path(screenshot_folder, f"new_icon_{i}.png").resolve()
|
||||||
)
|
)
|
||||||
icon_div.screenshot(icon_screenshot)
|
icon_div.screenshot(icon_screenshot)
|
||||||
|
i += 1
|
||||||
|
|
||||||
print("Finished peeking the icons...")
|
print("Finished peeking the icons...")
|
||||||
|
Reference in New Issue
Block a user