1

I'm trying to automate an application using Selenium Webdriver. The moveToElement function fails when the browser is minimized or not active (keep other app active). It works when I keep AUT browser as the active window.

My code:

menu=driver.findElement(By.xpath(OwnerName));
builder.moveToElement(menu).build().perform();

Here is the error:

java.lang.Exception: //div[contains(@class,'profileCardBtnsContainer')]//dt[text()='Actions'] is not found on the page with in the time period
 [java]     at main.java.com.ca.saas.UXMedia.utils.Globals.waitForElementPresent(Globals.java:191)
 [java]     at main.java.com.ca.saas.UXMedia.utils.ChatUtils.initiatingChatFromDeviceList(ChatUtils.java:258)
 [java]     at main.java.com.ca.saas.UXMedia.Tests.ChatTests.verifyChatFromDevices(ChatTests.java:1031)
 [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 [java]     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 [java]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 [java]     at java.lang.reflect.Method.invoke(Unknown Source)
 [java]     at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:76)
 [java]     at org.testng.internal.Invoker.invokeMethod(Invoker.java:673)
 [java]     at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:846)
 [java]     at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1170)
 [java]     at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
 [java]     at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
 [java]     at org.testng.TestRunner.runWorkers(TestRunner.java:1147)
 [java]     at org.testng.TestRunner.privateRun(TestRunner.java:749)
 [java]     at org.testng.TestRunner.run(TestRunner.java:600)
 [java]     at org.testng.SuiteRunner.runTest(SuiteRunner.java:317)
 [java]     at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:312)
 [java]     at org.testng.SuiteRunner.privateRun(SuiteRunner.java:274)
 [java]     at org.testng.SuiteRunner.run(SuiteRunner.java:223)
 [java]     at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
 [java]     at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
 [java]     at org.testng.TestNG.runSuitesSequentially(TestNG.java:1039)
 [java]     at org.testng.TestNG.runSuitesLocally(TestNG.java:964)
 [java]     at org.testng.TestNG.run(TestNG.java:900)
 [java]     at org.testng.TestNG.privateMain(TestNG.java:1182)
 [java]     at org.testng.TestNG.main(TestNG.java:1146)
  • 2
    I do not expect Webdriver to work when the brower is minimized. – user246 Jan 30 '12 at 12:21
  • Not sure what the question is here... Yes your assertion is correct WebDriver doesn't work properly when the browser is minimised. This is because it uses native events to click on the browser rather than just emulating clicks with JavaScript so if it isn't there to click on the clicks don't work. – Ardesco Feb 6 '12 at 16:57
3

WebDriver does not work properly when the browser is minimized.

  • if web driver is openig multiple browsers, can you close them after x seconds? – Thufir Oct 6 '14 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.