In my main project in IntelliJ I cannot get my selenium tests to run. I’ve now created a cut-down project that has only the example code from The 5 Minute Getting Started Guide and is using the selenium-server-standalone-2.8.0.jar.
When I run with the FirefoxDriver I have no problems. When I try to run with the IEDriver however, I get the following output:
"C:\Program Files\Java\jdk1.6.0_26\bin\java" -Didea.launcher.port=7534 "-Didea.launcher.bin.path=C:\Program Files\JetBrains\IntelliJ IDEA 10.0.3\bin" -Dfile.encoding=ISO-8859-1 -classpath "C:\Program Files\Java\jdk1.6.0_26\jre\lib\alt-rt.jar;C:\Program Files\Java\jdk1.6.0_26\jre\lib\alt-string.jar;C:\Program Files\Java\jdk1.6.0_26\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.6.0_26\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.6.0_26\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.6.0_26\jre\lib\jce.jar;C:\Program Files\Java\jdk1.6.0_26\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.6.0_26\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.6.0_26\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.6.0_26\jre\lib\resources.jar;C:\Program Files\Java\jdk1.6.0_26\jre\lib\rt.jar;C:\Program Files\Java\jdk1.6.0_26\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.6.0_26\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.6.0_26\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.6.0_26\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.6.0_26\jre\lib\ext\sunpkcs11.jar;C:\development\playground\selenium\out\production\Selenium Playground;C:\Users\rachel.swailes\Downloads\selenium-server-standalone-2.8.0.jar;C:\Program Files\JetBrains\IntelliJ IDEA 10.0.3\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain Example
new File(".").getAbsolutePath() = C:\development\playground\selenium\.
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.openqa.selenium.ie.InternetExplorerDriver.setup(InternetExplorerDriver.java:84)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:50)
at Example.main(Example.java:13)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)
Caused by: org.openqa.selenium.WebDriverException: java.lang.UnsatisfiedLinkError: Unable to load library 'IEDriver': com.sun.jna.Native.open(Ljava/lang/String;)J
Build info: version: '2.8.0', revision: '14056', time: '2011-10-06 12:41:26'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_26'
Driver info: driver.version: InternetExplorerDriver
at org.openqa.selenium.ie.InternetExplorerDriverServer.initializeLib(InternetExplorerDriverServer.java:129)
at org.openqa.selenium.ie.InternetExplorerDriverServer.<clinit>(InternetExplorerDriverServer.java:38)
... 8 more
Caused by: java.lang.UnsatisfiedLinkError: Unable to load library 'IEDriver': com.sun.jna.Native.open(Ljava/lang/String;)J
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:166)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:239)
at com.sun.jna.Library$Handler.<init>(Library.java:140)
at com.sun.jna.Native.loadLibrary(Native.java:393)
at com.sun.jna.Native.loadLibrary(Native.java:378)
at org.openqa.selenium.ie.InternetExplorerDriverServer.initializeLib(InternetExplorerDriverServer.java:125)
... 9 more
Process finished with exit code 1
Now I have traced through the code inside InternetExplorerDriverServer and I can see the IEDriver.dll showing up in a temporary directory, but it cannot load it for some reason.
I am running Windows 7 and IE8 and I have loaded IntelliJ using “Run as Administrator” and I’m just out of ideas at this point. I also don’t know if all processes that IntelliJ starts in this mode also have admin privileges or if this is a red herring.
Also, using Dependency Walker on IEDriver.dll I can see that it thinks that IEShims.dll is not linked – but again, I’m not sure what to do with this information.
Can anyone suggest something else for me to try?
[edit]
I’ve now tried it on XP and I have the same problem so I guess it’s not the Windows 7 permissions. It must be something to do with how IntelliJ loads the file. If I copy and paste the execution line into the command line it will run, but it won’t run from IntelliJ.
Many thanks,
Rachel
After much digging…
IntelliJ 10.0.3 was adding
C:\Program Files\JetBrains\IntelliJ IDEA 10.0.3\bin\..\.\bin;to the path. When I added this to the command line, the application would fail and when I removed it it would pass.I tried on 10.5 Community Edition and had the same problem, but on 10.5 Ultimate Edition there is no problem. I didn’t think that there would be a difference so I didn’t upgrade my Ultimate Edition until today.
So in short – the answer was to upgrade IntelliJ. 🙂