Skip to content

Commit b6adba3

Browse files
Thomas-Boiamacado
andauthored
Script checks for visibility before screenshotting (#829)
Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com>
1 parent 1a14488 commit b6adba3

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

.github/scripts/build_assets/selenium_runner/PeekSeleniumRunner.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,18 @@ def peek_icons(self, svgs: List[str], screenshot_folder: str):
8686
main_content.screenshot(new_icons_path);
8787

8888
# go downward so we get the oldest icon first
89-
len_ = len(svgs)
90-
for i in range(len_, 0, -1):
91-
xpath = f'//*[@id="glyphSet0"]/div[{i}]'
92-
icon_div = self.driver.find_element_by_xpath(xpath)
89+
icon_divs_xpath = f'//div[@id="glyphSet0"]/div'
90+
icon_divs = self.driver.find_elements_by_xpath(icon_divs_xpath)
91+
icon_divs.reverse()
92+
i = 0
93+
for icon_div in icon_divs:
94+
if not icon_div.is_displayed():
95+
continue
9396

94-
# crop the div out from the screenshot
9597
icon_screenshot = str(
96-
Path(screenshot_folder, f"new_icon_{len_ - i}.png").resolve()
98+
Path(screenshot_folder, f"new_icon_{i}.png").resolve()
9799
)
98100
icon_div.screenshot(icon_screenshot)
101+
i += 1
99102

100103
print("Finished peeking the icons...")

0 commit comments

Comments
 (0)