Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    selenium RC trouble selecting item in combobox

    Using SGWT 2.5 nightly from Nov. 20 2011, Selenium-RC, Maven 3.0.3, Firefox, Mac OS X Lion.
    Text items work, but combo box item selection only works when firefox is in the foreground. Note below that the text item is clicked, which should show the list, but the selection of an item fails. This same test works if I bring the browser to the foreground, but that's not practical for CI etc. Entering values on text items always works.

    Any ideas?

    14:17:03.668 INFO - Command request: click[scLocator=//DynamicForm[ID="my_formA"]/item[name=thing_version]/textbox, ] on session 2b866f8d567e48ddab9d2cd6cbb0157b
    14:17:04.720 INFO - Got result: OK on session 2b866f8d567e48ddab9d2cd6cbb0157b
    14:17:04.723 INFO - Command request: click[scLocator=//DynamicForm[ID="my_formA"]/item[name=thing_version]/pickList/body/row[thing_version=2.9.1]/col[fieldName=thing_version], ] on session 2b866f8d567e48ddab9d2cd6cbb0157b
    14:17:05.764 INFO - Got result: ERROR: Element scLocator=//DynamicForm[ID="my_formA"]/item[name=thing_version]/pickList/body/row[thing_version=2.9.1]/col[fieldName=thing_version] not found on session 2b866f8d567e48ddab9d2cd6cbb0157b
    14:17:05.768 INFO - Command request: testComplete[, ] on session 2b866f8d567e48ddab9d2cd6cbb0157b
    14:17:08.033 INFO - Got result: OK on session 2b866f8d567e48ddab9d2cd6cbb0157b
    Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 23.217 sec <<< FAILURE!

    Thanks!
    ,chris

    #2
    What do you mean by "in the background"? Nothing related to focus will behave normally if the browser does not have OS-level focus. If your CI system is assuming this is not required, it may be irretrievably broken.

    Comment


      #3
      Did more experimentation and "background" was not quite right. What I meant by it was that if I click on the browser then the locator worked. But actually I was also maximizing the window. Now, as best I can tell, the only time the locator works to select and item in the list is when the combobox is visible in the browser window when the 'text item' is clicked.

      This seems very strange but it's what I see no matter if running the test via maven, running it from my IDE, or debugging it from my IDE. The clearest is when I debug it and step through the test steps. If the combobox is not visible for the 'click' then the list does not appear and then the locator for the item in the list fails.

      Here's my test code...
      Code:
      selenium.type("scLocator=//DynamicForm[ID=\"my_formA\"]/item[name=name]", "bob rob");
      verifyEquals("bob rob", selenium.getValue("scLocator=//DynamicForm[ID=\"my_formA\"]/item[name=name]"));
      
      selenium.click("scLocator=//DynamicForm[ID=\"my_formA\"]/item[name=thing_version]/textbox");
      selenium.click("scLocator=//DynamicForm[ID=\"my_formA\"]/item[name=thing_version]/pickList/body/row[thing_version=2.9.1]/col[fieldName=thing_version]");
      Wish I could be more clear, but so far this is all I've got on this one. I'll post again if I learn more.

      Has there been any changes to the selenium support since Nov. 20? Might an upgrade help?

      ,chris

      Comment


        #4
        Browsers in general will not allow you to click on something that's not visible - you would need to scroll it into view. The best thing is to configure your tools to create the browser as large as possible or at least as large as it was when you recorded the script.

        Comment


          #5
          I added this and the test works...
          Code:
          selenium.windowMaximize();
          But this would only work for tests on pages that are not too large.
          Also found a StackOverflow post saying Selenium 2 implicitly scrolls elements into view before interacting with them, which should always work. Maybe there's something about my code that is causing selenium to 'forget' its implicit behavior.

          Comment

          Working...
          X