NaviHan
2018-09-20 11:14:17 UTC
Hi
I have put this code in the hooks which takes scresnshot when a test fails.
The issue is that Im not getting the full browser screen. Its chops off at
the bottom
After do |scenario|
take_screenshot(@browser, scenario)
end
def take_screenshot(browser, scenario)
time = Time.now.strftime("%Y-%m-%d_%H%M")
if scenario.failed?
scenario_name = scenario.name.gsub(/[^\w\-]/, ' ')
screenshot_path = "#{scenario_name}" + "_failure_" + time
@browser.screenshot.save("./screenshots/#{screenshot_path}.png")
end
end
By the way my before hooks looks like this.
Before do|scenario|
ENV['HTTP_PROXY'] = ENV['http_proxy'] = nil
@browser.goto "https://www.sandbox.paypal.com"
@browser.cookies.clear
@browser.goto "https://portal-sandbox.afterpay.com"
@browser.cookies.clear
@browser.goto "https://i-pay.co.za"
@browser.cookies.clear
@browser.goto("ci.XXX.com/")
@browser.window.maximize
@browser.driver.manage.timeouts.implicit_wait = 0
@browser.cookies.clear
@browser.driver.manage.window.maximize
PageObject.default_element_wait=(10)
PageObject.javascript_framework = :jquery
end #before scenario
--
--
Before posting, please read https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
In short: search before you ask, be nice.
watir-***@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+***@googlegroups.com
---
You received this message because you are subscribed to the Google Groups "Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email to watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I have put this code in the hooks which takes scresnshot when a test fails.
The issue is that Im not getting the full browser screen. Its chops off at
the bottom
After do |scenario|
take_screenshot(@browser, scenario)
end
def take_screenshot(browser, scenario)
time = Time.now.strftime("%Y-%m-%d_%H%M")
if scenario.failed?
scenario_name = scenario.name.gsub(/[^\w\-]/, ' ')
screenshot_path = "#{scenario_name}" + "_failure_" + time
@browser.screenshot.save("./screenshots/#{screenshot_path}.png")
end
end
By the way my before hooks looks like this.
Before do|scenario|
ENV['HTTP_PROXY'] = ENV['http_proxy'] = nil
@browser.goto "https://www.sandbox.paypal.com"
@browser.cookies.clear
@browser.goto "https://portal-sandbox.afterpay.com"
@browser.cookies.clear
@browser.goto "https://i-pay.co.za"
@browser.cookies.clear
@browser.goto("ci.XXX.com/")
@browser.window.maximize
@browser.driver.manage.timeouts.implicit_wait = 0
@browser.cookies.clear
@browser.driver.manage.window.maximize
PageObject.default_element_wait=(10)
PageObject.javascript_framework = :jquery
end #before scenario
--
--
Before posting, please read https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
In short: search before you ask, be nice.
watir-***@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+***@googlegroups.com
---
You received this message because you are subscribed to the Google Groups "Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email to watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.