Automating webdialog/ie inside sketchup


#1

Hi,
We have a plugin which gets user input from the WebDialog and performs operations in sketchup. There are more than 20 different screens/html forms (HTML pages) which is used for designing a solar plant using Sketchup.

The question is, we have frequent releases with new features added to the plugin and the plugin is distributed internally within the company. I want to get some level of automation in place which will allow the QA team to develop automation scripts to test the webdialog/IE user interface as well as the resulting operation. While we can validate the result of an operation using ruby scripts, I really need help in building some automation of the internal webdialog.

Selenium, Watir-webdriver etc all open a new IE browser outside the context of Sketchup. Has anyone attempted automating the IE/WebDialog inside Sketchup. I tried ruby win32ole also, but the same result.
Is there some bridge or some pointers on how to get to automate the HTML from content (preferably with Ruby). Any help is appreciated.

Ravi


#2

A Wedialog opened within SketchUp offers many basic options - location, size etc.
Its content’s HTML/URL can be changed via Ruby commands.
JS/JQuery scripts can run in the page, but they can also be initiated from the Ruby-side [with passed parameters etc], so they can change most aspects of the page’s contents, appearance etc internally, AND called from the Ruby-side…
As well as Ruby-side affecting the Webdialog, the Webdialog itself can be set up to open with skp ‘callbacks’ attached, and so with corresponding JS calls set up to be linked to fire those data can be passed back to the Ruby-side, initiating Ruby-side changes.
Those in turn can affect the page…
There are many examples of Plugins which use Webdialogs, HTML, JS etc in this way


#3

TIG is spot-on: your description sounds like you are doing a single, static trip to and from your WebDialog. But a Ruby script can alter just about anything in the content displayed by the WebDialog - including after opening it - and can hold a two-way conversation with the javascript on the WebDialog to exchange info, and can display, print, or otherwise show what it got during a debugging run. The main cautions are about differences between Windows and Mac synchronization of javascript, which will matter only if your plugin needs to run in a mixed-platform setting.


#4

Thanks for the quick response. Yes, I am aware of the JS/Ruby side of things, as the plugin has been evolving for the past couple of years over different versions of Sketchup. So, my option is only to call “execute_script” and write wrappers to fill form fields and javascript/jquery clicks of the buttons in the form. What I was looking to was some sort of bridge or something which will remote control my webdialog forms ? Have you come across such remote control option of webDialog. It is not static, but dynamic content which gets displayed with calbacks and execute_script.


#5

@bradaskins - you done work with automating webdialogs?


#6

AutoHotkey? It can use SketchUp menus to activate plugins, it can focus the webdialogs, relocate them, resize the, move the mouse, click the mouse, send keys, and so on. I think it can locate controls in the dialog using a COM library. Works on Windows only.

Windows scripting and/or powershell can do automation also such as activate windows by name and sending keys.

Another option may be to use Ruby to call win32api functions.

Another possibility might be to use IE (not SketchUp’s embeded IE) and register a custom application protocol which would send the data to a program/script of your choice. Then you could use Watir on the browser for automation.


#7

Thanks Jim for the options. Definitely, application protocols is interesting, as i could then use watir-webdriver to automate the html forms.


#8

Were you able to automate Sketchup using Ruby? We are trying to automate Sketchup application which we use it to design our solar panels. We are using Python for our framework. Based on the posts, I understand we can use JS to interact with icons in the dialog box. Please share your implementation if you can. Thanks, !


#9

I just happened on this gem - looks interesting.