Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap driver.execute_script for async version in Chrome #584

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/wraith/save_images.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ def capture_image_selenium(screen_sizes, url, file_name, selector, global_before
driver.manage.window.resize_to(width, height || 1500)
driver.navigate.to url
driver.manage.timeouts.implicit_wait = wraith.settle
driver.execute_script(File.read(global_before_capture)) if global_before_capture
driver.execute_script(File.read(path_before_capture)) if path_before_capture
driver.execute_async_script(File.read(global_before_capture)) if global_before_capture
driver.execute_async_script(File.read(path_before_capture)) if path_before_capture
resize_to_fit_page(driver) unless height
driver.save_screenshot(new_file_name)
crop_selector(driver, selector, new_file_name) if selector && selector.length > 0
Expand Down
2 changes: 2 additions & 0 deletions spec/js/global--chrome.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
var callback = arguments[arguments.length-1];
(function () {
document.body.innerHTML = " ";
document.body.style['background-color'] = 'red';
callback();
})();
2 changes: 2 additions & 0 deletions spec/js/path--chrome.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
var callback = arguments[arguments.length-1];
(function () {
document.body.innerHTML = " ";
document.body.style['background-color'] = 'green';
callback();
})();