Status: New
Owner: ----
Labels: Type-Defect Priority-Medium Status-Untriaged

New issue 5422 by django...@gmail.com: PageFactory.initObjects fails on IE9
within 1 second of calling driver.switchTo().defaultContent()
http://code.google.com/p/selenium/issues/detail?id=5422

I had problems with getting DOM content with IE9 when testing an
application that had a lot of iframe switching. Firefox did not suffer
from this limitation. Finally, I figured out, to get it to work, I had to
add a 1 second Thread.sleep to the driver.switchTo().defaultContent() in
order to allow PageFactory.initObjects( driver, this); to be able to see
and load the iframe DOM. Here are the methods I used to fix my issue:

  public static void switchToIFrame( RemoteWebDriver drv ) {
   LOGGER.info("Switch to first iframe." );
   drv.switchTo().frame( frameId );
   waitForIFrame( drv );
  }

  public static void exitIFrame( RemoteWebDriver drv ) {
   drv.switchTo().defaultContent();
   try { //TODO this timeout is critical for IE
    Thread.sleep(1000);
   } catch (InterruptedException e) {
    e.printStackTrace();
   }
   LOGGER.info("Exited frame to main window content." );
  }

I thought I would report this so that a developer can think about this use
case and possibly fix this bug. It would be fairly difficult for me to
setup unit tests to prove this bug and so I hope this limited information
is enough to at least investigate.


Selenium version: 2.31.0
OS: Windows 7
Browser: IE9



--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups "Selenium Developer Activity" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-developer-activity+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-developer-activity@googlegroups.com.
Visit this group at http://groups.google.com/group/selenium-developer-activity?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Selenium at Mar 29, 2013 at 7:07 pm
    Updates:
      Status: NeedsClarification

    Comment #1 on issue 5422 by barancev: PageFactory.initObjects fails on IE9
    within 1 second of calling driver.switchTo().defaultContent()
    http://code.google.com/p/selenium/issues/detail?id=5422

    No, this information is not enough. Can you al least show a stack trace of
    a failure?

    PageFactory.initElements does not do *any* calls to the driver. It does not
    load the DOM. Or do you have your own implementation? (you told the method
    name is initObjects that is different)

    --
    You received this message because this project is configured to send all
    issue notifications to this address.
    You may adjust your notification preferences at:
    https://code.google.com/hosting/settings

    --
    You received this message because you are subscribed to the Google Groups "Selenium Developer Activity" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to selenium-developer-activity+unsubscribe@googlegroups.com.
    To post to this group, send email to selenium-developer-activity@googlegroups.com.
    Visit this group at http://groups.google.com/group/selenium-developer-activity?hl=en.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Selenium at Mar 29, 2013 at 9:45 pm
    Comment #2 on issue 5422 by auste...@gmail.com: PageFactory.initObjects
    fails on IE9 within 1 second of calling driver.switchTo().defaultContent()
    http://code.google.com/p/selenium/issues/detail?id=5422

    Yes, I meant to refer to PageFactory.initElements and I was in error when I
    stated PageFactory.initObjects .

    After calling switchTo().defaultContent() , one of 2 things caused the
    error if it occurs within less than 1 second after the call:
         1. PageFactory.initElements( driver, this);
         2. the very next driver.findElement or driver.click()

    It appears to me that the DOM is not ready before WebDriver tries to access
    the element. I tried to call initElements() just before re-accessing a
    element but still got the error and couldn't pinpoint the location of the
    cause.

    I will try to put together a unit test this weekend to show the problem.
    Once I have it prepared, I will post the link here.

    --
    You received this message because this project is configured to send all
    issue notifications to this address.
    You may adjust your notification preferences at:
    https://code.google.com/hosting/settings

    --
    You received this message because you are subscribed to the Google Groups "Selenium Developer Activity" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to selenium-developer-activity+unsubscribe@googlegroups.com.
    To post to this group, send email to selenium-developer-activity@googlegroups.com.
    Visit this group at http://groups.google.com/group/selenium-developer-activity?hl=en.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Selenium at Mar 30, 2013 at 1:14 am
    Comment #3 on issue 5422 by auste...@gmail.com: PageFactory.initObjects
    fails on IE9 within 1 second of calling driver.switchTo().defaultContent()
    http://code.google.com/p/selenium/issues/detail?id=5422

    Also, I need to try this as a workaround:
    driver.manage().timeouts().pageLoadTimeout( 1, TimeUnit.SECONDS );

    --
    You received this message because this project is configured to send all
    issue notifications to this address.
    You may adjust your notification preferences at:
    https://code.google.com/hosting/settings

    --
    You received this message because you are subscribed to the Google Groups "Selenium Developer Activity" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to selenium-developer-activity+unsubscribe@googlegroups.com.
    To post to this group, send email to selenium-developer-activity@googlegroups.com.
    Visit this group at http://groups.google.com/group/selenium-developer-activity?hl=en.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Selenium at Apr 6, 2013 at 7:05 pm
    Comment #4 on issue 5422 by django...@gmail.com: PageFactory.initObjects
    fails on IE9 within 1 second of calling driver.switchTo().defaultContent()
    http://code.google.com/p/selenium/issues/detail?id=5422

    I spent time trying to reproduce and I think I was able to resolve this by
    being more careful and using a FluentWait like so (
    https://github.com/djangofan/WebDriverTestingTemplate/blob/master/parallelwebdriver/src/test/java/webdriver/test/TestFrames.java
    ) :

      @Override
      protected void isLoaded() throws Error {
       LOGGER.info("IFrame1.isLoaded()...");
       PageFactory.initElements( driver, this );
       try {
        assertTrue( "Page visible title is not yet available.",
          driver.findElementByCssSelector("body
    form#webDriverUnitiFrame1TestFormID h1")
          .getText().equals("iFrame1 Test") );
       } catch ( NoSuchElementException e) {
        LOGGER.info("No such element." );
        assertTrue("No such element.", false);
       }
      }

      /**
       * Method: load
       * Overidden method from the LoadableComponent class.
       * @return void
       * @throws null
       */
      @Override
      protected void load() {
       LOGGER.info("IFrame1.load()...");
       Wait<WebDriver> wait = new FluentWait<WebDriver>( driver )
            .withTimeout(30, TimeUnit.SECONDS)
            .pollingEvery(5, TimeUnit.SECONDS)
            .ignoring( NoSuchElementException.class )
            .ignoring( StaleElementReferenceException.class ) ;
       wait.until( ExpectedConditions.presenceOfElementLocated(
         By.cssSelector("body form#webDriverUnitiFrame1TestFormID h1") ) );
      }

    --
    You received this message because this project is configured to send all
    issue notifications to this address.
    You may adjust your notification preferences at:
    https://code.google.com/hosting/settings

    --
    You received this message because you are subscribed to the Google Groups "Selenium Developer Activity" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to selenium-developer-activity+unsubscribe@googlegroups.com.
    To post to this group, send email to selenium-developer-activity@googlegroups.com.
    Visit this group at http://groups.google.com/group/selenium-developer-activity?hl=en.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Selenium at May 12, 2013 at 2:52 pm
    Updates:
      Status: Invalid
      Labels: -Status-Untriaged

    Comment #5 on issue 5422 by barancev: PageFactory.initObjects fails on IE9
    within 1 second of calling driver.switchTo().defaultContent()
    http://code.google.com/p/selenium/issues/detail?id=5422

    Closing after comment 4

    --
    You received this message because this project is configured to send all
    issue notifications to this address.
    You may adjust your notification preferences at:
    https://code.google.com/hosting/settings

    --
    You received this message because you are subscribed to the Google Groups "Selenium Developer Activity" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to selenium-developer-activity+unsubscribe@googlegroups.com.
    To post to this group, send email to selenium-developer-activity@googlegroups.com.
    Visit this group at http://groups.google.com/group/selenium-developer-activity?hl=en.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupselenium-developer-activity @
categoriesselenium
postedMar 29, '13 at 4:54p
activeMay 12, '13 at 2:52p
posts6
users1
websiteseleniumhq.org

1 user in discussion

Selenium: 6 posts

People

Translate

site design / logo © 2021 Grokbase