Chrome App Automation Frame Resize - Ruby

32 views
Skip to first unread message

tf...@vernier.com

unread,
Jul 22, 2014, 6:18:41 PM7/22/14
to seleniu...@googlegroups.com
Hello,

As part of my automation suite I am working on I have found that a few of the elements are not accessible if the frame I am acting on is hidden slightly. They are hidden because the Chrome App does not open in "maximize" mode.

I have looked around and have tried many different options to try and get the app frame at maximum size.

There are two main problems I have:

1) To automate the Chrome App a Chrome instance has to be opened and then the window acting upon needs to be switched to the app I wish to automate on.

2) Ruby does not allow arguments to be passed in mid-way through the line to specify the frame to resize. Optimally there should be a way to do this in Ruby but I have not found any documentation that says so.

This is the code I have:

$browserDriver = Selenium::WebDriver.for :chrome, :switches => %w[--load-and-launch-app=/Users/Tanner/Desktop/debug], :desired_capabilities => ({"chromeOptions" => {"args" => [ "--ash-host-window-bounds=1024x768*2"]}})                                                     #Driver instance
      sleep 5                                                                           #Sleep to wait for Chrome to open  
  $browserDriver.manage.timeouts.implicit_wait = 10         #Setting implicit timeout
                                
  window2 = $browserDriver.window_handles[1]                 #Setting a variable with the second frame handle
     
   $browserDriver.switch_to.window(window2)                    #Switch the active window to the Chrome App
   $browserDriver.switch_to.frame("sandbox")                     #Switch to the iframe that needs to be automated


***It is important to note that I do have the app automated at working.***

tf...@vernier.com

unread,
Jul 23, 2014, 11:47:39 AM7/23/14
to seleniu...@googlegroups.com
I got this working by using java script:

$browserDriver.execute_script("var appWindow = chrome.app.window.current(); appWindow.maximize()")

It might be reasonable to ask the Devs to put in a window argument into Ruby Selenium  under .resize_to() or .maximize()
Reply all
Reply to author
Forward
0 new messages