1

I am facing exactly same problem https://github.com/mozilla/geckodriver/issues/1358.

Firefox-headless mode screenshots taken from linux are missing input box

Question:

Do we have any alternative to solve this problem. I am using FF 83

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Jeya Kumar
  • 1,002
  • 1
  • 13
  • 36

2 Answers2

0

You saw it right. For Selenium driven GeckoDriver initiated Screenshot in headless mode doesn't show form controls correctly.

This issue was closed as the original issue is with Firefox and being tracked through Some input field are black when taking screenshot in headless mode is specific to platform where @Michael Smith mentioned:

It looks like this is a result of an nsITheme object not being created in headless mode under GTK, as nsNativeThemeGTK depends on APIs which we can't access in headless mode. As a result this shouldn't affect the Windows and macOS platforms.

Further he detailed:

We have existing fallback paths for when a nsITheme object is unavailable, but it looks like they're not being exercised on any of Windows, macOS, or Linux under normal conditions. For example, the width of the dropdown button is determined by the width of the scrollbar in the dropdown list. This is measured by GetNondisappearingScrollbarWidth, which boils down to asking the vertical scrollbar nsBoxFrame what its preferred width is. Normally this ends up being calculated using nsITheme::GetMinimumWidgetSize which calls out to platform-specific code; in the absence of a theme, we rely on the computed size from the CSS applied to the scrollbar XUL element and its children. Note that vertical scrollbar thumbs have a minimum height assigned, but no minimum width, so the computed scrollbar width ends up being 0, and the dropdown buttons end up being 0-width. Adding a minimum width to thumb[orient="vertical"] causes the dropdown buttons to show up under headless mode. It also causes the scrollbar to show up along the side, but there's no color set for the slider, so it's just a white strip.


Conclusion

This issue was assigned Priority 3 and is still in Open state with no alternatives.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
0

This can be solved using firefox settings.

widget.disable-native-theme-for-content to true

Reference :

https://www.reddit.com/r/firefox/comments/k2nghh/any_alternatives_for_firefoxlinuxheadless/

PS: Credit goes to reddit user who answered my question :)

I verified it is working.

Jeya Kumar
  • 1,002
  • 1
  • 13
  • 36