We have an automation project which is developed with selenium webdriver and ruby(capybara). We collect screenshots when test case fails. Screenshots are totally fine when we run cases on our local machines. But when we run them on remote machine, we are facing with an character encoding problem on the screenshots. Do you have any idea to fix this problem?
Sample screenshot:
Chromedriver version: 2.38.552522
Chrome version: Google Chrome 66.0.3359.139
Remote machine:
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
Driver configuration:
Capybara.default_driver = :headless_chrome
Capybara.javascript_driver = :headless_chrome
Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new(app, browser: :chrome)
end
Capybara.register_driver :headless_chrome do |app|
options = Selenium::WebDriver::Chrome::Options.new
options.add_argument 'headless'
options.add_argument 'disable-gpu'
options.add_argument 'disable-popup-blocking'
options.add_argument 'no-sandbox'
Capybara::Selenium::Driver.new app, browser: :chrome, options: options
end
Collect screenshot:
page.save_screenshot('testResults/report_smoke_mobile/screenshot_'+scenario.name+'.png')