Setting Variables with Scripting API


#1

I’ve read about using variables with the scripting API, I’ve tried to use an example posted on GitHub: https://github.com/A9T9/SeeShell/tree/master/Powershell/change-URL-at-runtime

I’m not able to get it working however. Below is the code I’ve written:

$seeShellObject = new-object -ComObject SeeShell.Browser
$openSeeShell = $seeShellObject.open(10)
Write-Host "Open SeeShell Browser:" $openSeeShell

$testURL = "http://fitnlabsspdev3.isis.cclrc.ac.uk/sites/XFU.ISIS/Pages"
$seeShellObject.setVariable("testURL", $testURL)

$goToDevSite = $seeShellObject.Play("C:\Users\XFU59478\Documents\SI Site BLAATs\Macros\GoToDevSite.see")
Write-Host "GoToDevSite:" $goToDevSite

$closeSeeShell = $seeShellObject.close(10)
Write-Host "Close SeeShell Browser:" $closeSeeShell

Below is a screenshot of the macro:

I’ve implemented this as shown on GitHub however when the macro runs, it looks for a URL ‘{testURL}’ (which obviously just results in a white page) instead of looking for the variable testURL. Inside the macro for the value of the open command, I’ve tried:

  • {testURL}
  • $testURL
  • ${testURL}
  • $testURL$
  • { testURL }

All these combinations don’t seem to work. Any ideas on how to get SeeShell to look for the variable?
Thanks!


#2

Sorry about that. This demo macro had two issues: It did not have the new variable format and mixed lowercase/uppercase (both fixed now).

  1. Format: Since version 3, SeeShell variables have the ${variable} format. This change was made so that SeeShell and Kantu (and Selenium IDE) variables use the same format. This should reduce confusion in the future.

  2. Lowercase: Variable names should be all lowercase. This is in contrast to internal variables, which are uppercase and start with !.

=> So the version that will work is: ${testurl}


#3

Update: With the new SeeShell release, variables are now case-insensitive, so helloworld and HelloWOLRD ate the same.