Selenium Issues

This forum is for Selenium specific usage or questions

This is a public Discussion Area  publicRSS

Post

    James O'Sullivan
    Accessing parent.selenium.browserbot
    Post posted February 27, 2009 by James O'Sullivan
    7354 Views, 2 Comment
    Topic:
    Accessing parent.selenium.browserbot
    Body:
    I’m trying to access selenium from my client side script so that I can call modifyWindowToRecordPopUpDialogs() and work around the issue with alerts fired by window.onload. When I access the page via Twist parent.selenium comes back undefined. I am able to see parent.selenium via a DOM explorer though. Here’s the code I’m trying to execute: if (parent.selenium) { parent.selenium.browserbot.modifyWindowToRecordPopUpDialogs(window, parent.selenium.browserbot);} Any ideas? Thanks

    Comment

    • thamaraiselvan
      posted March 1, 2009 by thamaraiselvan

      I am hoping that you are trying to send alerts fired by window.onload of pop-ups to base(opener) window in IE. If this is the case, to refer selenium object of base window (opener), you should use opener.selenium instead of parent.selenium. In order to send “alerts” to opener window, you may have client side script as below

      ...
      if (opener.selenium) {                
          window.alert = function(alert) {
              window.opener.selenium.browserbot.recordedAlerts.push(alert);
          }
      }
      ...
      

      and twist driver code would look like

      //select base window
      selenium.selectWindow(null);
      
      //get the alert string
      String strAlert = selenium.getAlert();
      
      Assert.....
      
    • James O'Sullivan
      posted March 2, 2009 by James O'Sullivan

      Actually the sample code I pasted in was incorrect I was trying to use window.selenium.browserbot not parent.

      I ended up finding a solution to the getAlert() issue by modifying the appropriate code to be included in a window.setTimeout().