0
votes

Hi I am beginning to start automating some tests. I am trying to verify that certain submenu options exist when you hover over the dropdown menu. But I get an error returned from PHPUnit:

PHPUnit_Extensions_Selenium2TestCase_WebDriverException: Element is not currently visible and so may not be interacted with Command duration or timeout: 16 milliseconds Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:11:15' System info: host: 'WIN-5FCJ9IIGCSP', ip: '192.168.31.128', os.name: 'Windows Server 2008 R2', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_51' Session ID: 9fad5b24-2a1e-472d-bb36-b8914b3a92c2 Driver info: org.openqa.selenium.firefox.FirefoxDriver Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, cssSelectorsEnabled=true, databaseEnabled=true, browserName=firefox, handlesAlerts=true, browserConnectionEnabled=true, webStorageEnabled=true, nativeEvents=false, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=27.0.1}]

I have been searching the web and would appreciate any help Thanks Conor

2

2 Answers

0
votes

Before you search for the element(dropdown) Try to put a:

sleep(3); // This will make it sleep for 3seconds

Or waitForElementPresent could work aswell. And see what you get. Selenium might think that the page is already loaded and tries to find the element which isn't loaded yet: Element is not currently visible

0
votes

I'm also at the very beginning of selenium, but here is a solution I wrote for clicking a dropdown element

for($tick=0 ; $tick<5 ; $tick++){
    $this->moveto($this->byCssSelector('#dropDown'));
}

$this->byLinkText("Settings")->click();

If I didn't wrap the moveto() with the for loop, it would just hover momentarily and didn't work, so the ticking kept it hovered.

I suggest you to use the waitUntil() function and check when your element is displayed()