Automating webdialog/ie inside sketchup

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

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

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.

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.

@bradaskins - you done work with automating webdialogs?

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.

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

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, !

I just happened on this gem - looks interesting.

1 Like