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.

Select Option Confusion

cdeistcdeist Members
edited April 2013 in Sahi - Open Source
Hi everybody!
Working on something here that I KNOW has been covered on this forum before...but I've tried everything I could come across searching this site to no avail.

Long story short: I am trying to build an array when my script hits a popup page out of a select/option drop down list that exists on it.
Below is the code:
var $ATDD = [];
var $blah = _popup("newWindow")._select("landingPages[Article][type]").options;


for (var $i=0; $i< $blah.length; $i++)
{
var $biff = $blah[$i].text;
$ATDD.unshift($biff);
_alert($ATDD);
}

function moop ($ATDD)
{

return $ATDD;
}

Ok so putting this into the Sahi evaluate expression area works! I can see the array load in the alert, and in the console. The moment i put it into a script it starts whining at me that _popup("newWindow")._select("landingPages[Article][type]").options; or ANY variation of it, is undefined.
I've tried pushing it out to the browser via <browser> and use of document.GetElementsByName() but the same scenario plays out. In the evaluate expression area, it works, in the script, it does not.
I've even gone so far as to eliminate the multiple layers of abstraction, and put the above code into a very simple, one layer script with no includes, and still nada.
I've been working on this now for 7 hours straight, and my brain is pretty shot.
Ideas?
Thanks!
Cory



Answers

  • cdeistcdeist Members
    the Select drop down is housed in a <td></td> and looks like this
    <select name="landingPages[Article][type]">
    <option value="BOA-article-landing" >BOA-article-landing</option>
    <option value="BOA-category-landing" >BOA-category-landing</option>
    <option value="BOA-show-site" >BOA-show-site</option>
    <option value="aboutus" >aboutus</option>
    <option value="article-landing" >article-landing</option>
    </select>
  • Hi Cory,

    hmm.. you could also get the value like this:
    var $ATDD = _getText(_select("landingPages[Article][type]");
    

    It returns the options in array as well.
  • cdeistcdeist Members
    Hey Lonely_girl01 - where would you put that? in place of the variable, array declaration?
    Cory
Sign In or Register to comment.