Hi,
I like SeeShell and I am considering getting the Pro version. I’m trying to follow the documentation for scripting and having issues. I took the demo from your GitHub (links are broken in documentation by the way) and tried to run both C# and powershell but can’t seem to get them to work. It can’t find the object “Kantu” when run, but it can find “SeeShell”. I downloaded SeeShell about 15 days ago so I assume I have the trial pro features to enable scripting. Can you provide any more guidance?
Goal is to run multiple macros in succession and output error messages via text file (what macro failed, which step, image file name at failure, etc.) to infer cause of failures without having to go manually go into SeeShell to run tests.
Ok thanks, got it running with SeeShell.Browser. A couple of questions
#1: I’m trying to run multiple macros together. Is there a way to run multiple macros in sucession without refreshing the page? Currently the page refreshes each time a new macro is run.
#2: Also, I’d like to change how the image file paths are specified. By default, it will look in a folder that shares the same name as the macro.
Ex: Macro name = Test123.see
Image directory = Test123
Is there a way to specify a different folder, such as specifying a relative / absolute image file path within the macro? I’d like all of my macros to refer to one single directory, instead of many sets of folders being created for each macros’ images.
Did you remove the Open command(s) from the 2nd/3rd… macro you call? Without them, there should be no refresh, and the 2nd macro continues where the first stopped.
Here’s what we’re trying to do… We want to create several small “component” macros (1 - Open Page, 2 - Click optional button, 3 - Select field, 4 - Click Save, etc.). We then want to be able to run any combination of these macros in series (and run other combinations in parallel). We figure the two ways to do this are to run multiple macros using some code like this:
Macros 2 and 3 contain at most 3 commands (ex: Click “Save”, done), but it still refreshes upon running the macro. Here’s the full JSON of one these macros:
If we can’t fix the browser refresh problem, we would want a quick and convenient way to generate a new SeeShell macro by aggregating several component macro JSONs and image files.
Lastly, is there more extensive documentation on the API so I can see type information?
Ex: the type return for SeeShell.browser is dynamic. This means I can write and compile bad commands, and only find errors when running the scripting app.
From your code snippets, I see that you have .open inside the loop (or is this a typo)? You need .open (= opens SeeShell Browser) only once per instance. And then use only PLAY commands.
About the documentation: We plan a bigger update for the SeeShell docs in September. Meanwhile, please ask if anything is unclear. That helps as also the with improving the docs.
Here is a sample VBS script that runs several macros - no refresh should happen between each Play command. You find this script in the /documents/SeeShell.Browser/API folder. Note that i = myBrowser.open(true) is outside the loop.
'
' Self-test for Browser replay
'
' This script runs all demo scripts and logs the result
'
option Explicit
Dim objFileSystem, objFile, myBrowser
Dim strOutputFile, i
dim objList, element, hasError
Const OPEN_FILE_FOR_APPENDING = 8
' generate a logfile name based on the script name
strOutputFile = "./log_"+ Wscript.ScriptName + ".txt"
Set objFileSystem = CreateObject("Scripting.fileSystemObject")
Set objFile = objFileSystem.CreateTextFile(strOutputFile, TRUE)
msgbox ("Click OK to start. This test will take a few minutes.")
objFile.WriteLine("Self-Test started at " + cstr (now))
set myBrowser = CreateObject ("SeeShell.Browser")
if myBrowser Is Nothing then
objFile.WriteLine("CreateObject ERROR: " + cstr(i) + " Text: " + myBrowser.getLastError())
hasError = true
end if
i = myBrowser.open(true)
if i < 0 then
objFile.WriteLine("Open ERROR: " + cstr(i) + " Text: " + myBrowser.getLastError())
hasError = true
end if
'List of Test Scripts
Set objList = CreateObject("System.Collections.ArrayList")
objList.Add "Demo-Automate-Forms"
objList.Add "Demo-ITA-Flight-Search"
objList.Add "Demo-WebScraping"
objList.Add "Demo-Variables"
objList.Add "Demo-Download"
objList.Add "Demo-Upload"
objList.Add "Demo-PDF-Extract"
objList.Add "Demo-Mouse-Draw"
objList.Add "Demo-Variables"
objList.Add "Demo-Scroll"
objList.Add "Demo-Javascript"
objList.Add "Demo-ClickRelative"
' For Flash to work, install Flash: https://a9t9.com/kantu/flash#install
objList.Add "Demo-Flash"
'Run the tests!
Dim testnumber
testnumber = 1
For Each element In objList
i = myBrowser.echo ("Currently testing: " + element + " (" + cstr(testnumber) +" of " + cstr(objList.Count)+")")
i = myBrowser.Play (cstr(element))
if i >= 0 then
objFile.WriteLine("Play OK: " + element)
else
objFile.WriteLine("Play ERROR, Script: " + element + " Error code: " + cstr(i) + " Text: "+myBrowser.getLastError())
hasError = true
end if
testnumber = testnumber+1
Next
'Close
i = myBrowser.close
if i < 0 then
objFile.WriteLine("Open ERROR: " + cstr(i) + " Text: " + myBrowser.getLastError())
hasError = true
end if
' close log file
objFile.Close
Set objFileSystem = Nothing
'inform
if (hasError) then
msgbox ("There were some errors. Please check the log file: " + strOutputFile)
else
msgbox ("All tests passed.")
end if
WScript.Quit(i)
That’s not a typo, j == 0 upon start, and will increment past 0 (return false) during next run, preventing new browsers from opening.
Regardless I modified the code and still having the refresh problem in between each macro.
Also confirmed subsequent macros do not have any Open commands.
I think this might be a bug?
Below is modified C# code:
i = myKantu.open(true);
for (int j = 0; j < myScripts.Count; j++)
{
textBoxLog.Text += "Macro Name: " + myScripts[j] + "\r\n";
if (i < 0) textBoxLog.Text += "Kantu Open Error: " + i.ToString() + " Text: " + myKantu.getLastError() + "\r\n";
myKantu.echo("Hello from the C# app: "+ myScripts[j]);
textBoxLog.Text += "Start Script\r\n";
i = myKantu.play(myScripts[j]);
if (i < 0)
{
textBoxLog.Text += "Script Replay Error: " + i.ToString() + " Text: " + myKantu.getLastError() + "\r\n";
}
else
{
textBoxLog.Text += "Script completed - OK\r\n";
}
myKantu.echo("Done");
}
Ouch, I confirmed that the latest version of the SeeShell Browser free/trial version has indeed a “refresh at macro start” bug . That should not happen. The PRO/PRO Plus editions are not affected.
I created a ticket for this and we will fix the issue asap. A patch for this issue should be available by the end of next week.
We just released V3.2.1.2 of the SeeShell Browser, which should fix the issue discussed here.
The updated installer also includes a new Powershell test file SeeShell-ManyPlay-Demo.ps1. It runs three macros one after the other, each continuing where the other macro has left off.
Of course, please let me know if this version does not solve the issue.