18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

JSERROR ReferenceError: "top" n'est pas d

sahitester2009sahitester2009 Members
edited November -1 in Sahi - Open Source
Hello,

I would like to know why when i run this script i get the following error : JSERROR ReferenceError: "top" is not defined at 2009-04-23 15:56:08

var myDate = new Date();
var myMonth = new Array(12);
var myYear = myDate.getFullYear();
var $language = top.document.links[3].textContent;

if ($language == "English")
{
myMonth[0]="January";
myMonth[1]="February";
myMonth[2]="March";
myMonth[3]="April";
myMonth[4]="May";
myMonth[5]="June";
myMonth[6]="July";
myMonth[7]="August";
myMonth[8]="September";
myMonth[9]="October";
myMonth[10]="November";
myMonth[11]="December";
}

else
{
myMonth[0]="Janvier";
myMonth[1]="F

Comments

  • dpdp Members
    Sahi's documentation says that to store a page dependent variable to a sahi variable, we need to use _set API. So, if you replace the assignment statement to

    _set($language, top.document.links[3].textContent);

    should work for you
  • Thanks you
  • AbePetrilloAbePetrillo Members
    edited January 2012
    Have the same problem using _set()

    _set($path, top.location.pathname)

    Get the error "top" is not defined

    Update:

    Changing the $path to $pathname seemed to work. Also not setting a value before the _set of $pathname seemed to help
Sign In or Register to comment.