Selenium 2 test "_blank" Window

95 views
Skip to first unread message

Wazlav Gisycki

unread,
Jun 26, 2013, 7:18:24 AM6/26/13
to seleniu...@googlegroups.com
i'm runnin a hedless selenium (PHPUnit) Test on my VM this way:
Code hier eingeben...
Xvfb :99 -ac &>/dev/null & DISPLAY=:99 java -jar selenium-server-standalone-2.33.0.jar -browserSideLog -firefoxProfileTemplate "/root/.mozilla/firefox/i5a8df1g.default"


   
And it works fine.
Now i try to test a form which opens a new window when it is submitted, running the Test in Selenium IDE works fine. A new Window opens and a can check if a title or a element is present.


Code hier eingeben...
<tr>
       
<td>submit</td>
        <td>/
/form[@action='/?ac=user&amp;ac2=cb']</td>
       
<td></td>
    </
tr>
   
<tr>
       
<td>storeEval</td>
        <td>selenium.getAllWindowNames()[1];</
td>
       
<td>windowName</td>
    </
tr>
     
<tr>
       
<td>selectWindow</td>
        <td>${windowName}</
td>
       
<td></td>
    </
tr>


when i use the getAllWindowNames() function in IDE i allways get something like "_blank123456" back in the windowName variable so i can access to it using selelctWindow(${windowName}) function 

when i Export it to PHPUnit i get this code:
Code hier eingeben...

    $this
->submit("//form[@action='/?ac=user&ac2=cb']");
    $windowName
= $this->getEval("selenium.getAllWindowNames()[1];");
    $this
->selectWindow($windowName);


In PHPUnit this function allways returns "null" so it seems that there is no new window.

When i use PHPUnit function $this->getAllWindowNames(); directly i get back an array with 1 entry (name of the main window)
 i allready disabled the FF popup blocker but without any effect. When i ran the test in on the vm in a xwindow then it worked too. But running it headless always fails. In the Selenium log i can see that warnig " Link has target '_blank', which is not supported in Selenium! Randomizing target to be: selenium_blank53589" , but i don't know how to access the opened window, the functions "getAllWindowNames", "getAllWindowIds" seems not  to work.
Any suggestions to make it work?
Sincerely.
Many thanks.
Reply all
Reply to author
Forward
0 new messages