-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathscreenshot.rb
19 lines (14 loc) · 886 Bytes
/
screenshot.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require "selenium-webdriver"
options = Selenium::WebDriver::Chrome::Options.new(args: ["--force-device-scale-factor=1"])
driver = Selenium::WebDriver.for :chrome, options: options
wait = Selenium::WebDriver::Wait.new(timeout: 20)
driver.get "http://localhost:3000/"
date = Time.now.strftime("%m/%d/%Y")
driver.find_element(:xpath, "//*[contains(text(), 'Task 1')]").click
driver.find_element(:xpath, "//*[contains(text(), 'Planned')]/following::input[@type = 'date']").send_keys(date)
driver.find_element(:xpath, "//*[contains(text(), 'Actions')]").click
main = driver.find_element(:xpath, "//*[contains(@class, 'outerContainer')]")
driver.execute_script("arguments[0].style.maxWidth = '1000px'", main)
driver.execute_script("arguments[0].style.maxHeight = '550px'", main)
driver.execute_script("arguments[0].style.minHeight = 'auto'", main)
main.save_screenshot("screenshot.png")