AutoItDriverServer icon indicating copy to clipboard operation
AutoItDriverServer copied to clipboard

Bad zip file exception on try sendKeys a file with local file detector

Open daluu opened this issue 9 years ago • 1 comments

Performing a sendKeys operation with local file detector enabled like:

((RemoteWebDriver) autoitDriver).setFileDetector(new LocalFileDetector()); autoitDriver.findElement(By.className("Edit1")).sendKeys("C:\Users\dluu\Pictures\birdoparac.jpg");

throws exception:

org.openqa.selenium.WebDriverException: class 'zipfile.BadZipfile' Command duration or timeout: 31 milliseconds Build info: version: '2.41.0', revision: '3192d8a', time: '2014-03-27 17:17:32' System info: host: 'dluu-T420s', ip: '172.20.200.87', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_07' Session ID: 127.0.0.1:4723 Driver info: org.openqa.selenium.remote.RemoteWebDriver Capabilities [{caretCoordMode=1, mouseClickDelay=10, platform=WINDOWS, browserName=AutoIt, mouseCoordinateMode=1, winDetectHiddenText=0, mouseClickDownDelay=10, winTextMatchMode=1, mouseClickDragDelay=250, winWaitDelay=250, sendCapslockMode=1, version=0.1, expandEnvStrings=0, sendKeyDelay=5, sendKeyDownDelay=5, sendAttachMode=0, winTitleMatchMode=1, winSearchChildren=0, takesScreenshot=false}] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595) at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:268) at org.openqa.selenium.remote.RemoteWebElement.upload(RemoteWebElement.java:105) at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:93) at SeleniumIntegrationTest.test(SeleniumIntegrationTest.java:60) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Server logs don't indicate much. Didn't have proxy server setup to monitor request & response. To look into more later.

Comparatively, same sendKeys through Python (which has local file detector enabled by default, no turn off without modifying Python bindings source code) does not run into this problem. The zip is created and sent over then extracted successfully, with latest Python bindings. Only a problem here in Java, tested with JAR 2.41 and 2.33.

Workaround is to disable local file detector and send path as is in Java for now, assuming remote node has the path to file.

daluu avatar Jan 22 '15 20:01 daluu

Would be nice to check if the other language bindings run into issue with file uploads when send keys. Including unofficial bindings. .NET, Ruby, Javascript, PHP, Perl

daluu avatar Feb 16 '15 18:02 daluu