If you develop DNN modules and need to support several installations in sync, any automated help is welcome.
I tried to use Selenium to automate Firefox to upload module packages into a DNN installation. (I did not find any references as to whether DNN has a built-in update mechanism for custom modules). Download Selenium IDE and press Record.
The result is a Selenium Test Case that performs the following operations
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head profile="http://selenium-ide.openqa.org/profiles/test-case"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="selenium.base" href="http://localhost/" /> <title>dnn2ml update BGT.Flash</title> </head> <body> <table cellpadding="1" cellspacing="1" border="1"> <thead> <tr><td rowspan="1" colspan="3">dnn2ml update BGT.Flash</td></tr> </thead><tbody> <tr> <td>open</td> <td>http://localhost/dnn/GettingStarted/tabid/83/ctl/Login/Default.aspx?returnurl=%2fdnn%2fMain.aspx</td> <td></td> </tr>
Retrieve the login URL by right-clicking the Login button and copying the URL. The tabid usually changes between installations.
<tr> <td>type</td> <td>id=dnn_ctr_Login_Login_DNN_txtUsername</td> <td>host</td> </tr> <tr> <td>type</td> <td>id=dnn_ctr_Login_Login_DNN_txtPassword</td> <td>PASSWORD</td> </tr>
Edit Host (Superuser) username and password
<tr> <td>clickAndWait</td> <td>id=dnn_ctr_Login_Login_DNN_cmdLogin</td> <td></td> </tr> <tr> <td>clickAndWait</td> <td>//div[@id='dnn_cp_RibbonBar_adminMenus']/ul/li[2]/div/ul/li/ul/li[10]/a/span</td> <td></td> </tr>
I added these two steps to change to Edit mode (I have no idea how the View/Edit mode is set right after login). This will cause a timeout if DNN is already in Edit mode.
<tr> <td>select</td> <td>id=dnn_cp_RibbonBar_ddlMode</td> <td>label=Edit</td> </tr> <tr> <td>clickAndWait</td> <td>css=option[value="EDIT"]</td> <td></td> </tr>
Invoke Install Extension Wizard
<tr> <td>click</td> <td>link=Install Extension Wizard</td> <td></td> </tr> <tr> <td>type</td> <td>id=dnn_ctr_Install_wizInstall_cmdBrowse</td> <td>C:\path\to\MyModule\packages\MyModule_00.00.01_Source.zip</td> </tr>
Select package file to be uploaded
<tr> <td>clickAndWait</td> <td>id=dnn_ctr_Install_wizInstall_StartNavigationTemplateContainerID_nextButtonStart</td> <td></td> </tr> <tr> <td>clickAndWait</td> <td>id=dnn_ctr_Install_wizInstall_chkRepairInstall</td> <td></td> </tr>
This is for updating modules, so we need to check the Repair flag
<tr> <td>clickAndWait</td> <td>id=dnn_ctr_Install_wizInstall_StepNavigationTemplateContainerID_nextButtonStep</td> <td></td> </tr> <tr> <td>clickAndWait</td> <td>id=dnn_ctr_Install_wizInstall_StepNavigationTemplateContainerID_nextButtonStep</td> <td></td> </tr> <tr> <td>clickAndWait</td> <td>id=dnn_ctr_Install_wizInstall_StepNavigationTemplateContainerID_nextButtonStep</td> <td></td> </tr> <tr> <td>click</td> <td>id=dnn_ctr_Install_wizInstall_chkAcceptLicense</td> <td></td> </tr> <tr> <td>clickAndWait</td> <td>id=dnn_ctr_Install_wizInstall_StepNavigationTemplateContainerID_nextButtonStep</td> <td></td> </tr> <tr> <td>clickAndWait</td> <td>//body[@id='Body']/div[4]/div/a[2]</td> <td></td> </tr> <tr> <td>clickAndWait</td> <td>id=dnn_LOGIN1_loginLink</td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> </tr> </tbody></table> </body> </html>
Logout after upload.
Note that this simple script expects the browser to be logged out in DNN.
The sample may be made more stable by using conditions such as provided by Selenium IDE Flow Control.