There is a lot of stuff that you need to configure when you are working with selenium [depending on your needs] but the simplest would be to just have eclipse and selenium - that is all you need, everything else is just an add-on, for specific task\extension that you want to have.
You would need to have the following bare minimum.
1. Selenium jars [most populare being the java specific bindings]
2. Eclipse
3. Java Development Kit [JDK] - Ensure to point everything to JDK and not the JRE.
Steps to configure selenium and eclipse -
- Configure Java by installing the latest version of the JDK [default setup - no customizations needed] and then, add the following Java Environment variables
Path -
;C:\Program Files\Java\jdk1.7.0_10\bin;
JAVA_HOME -
C:\Program Files\Java\jdk1.7.0_10
JDK_HOME -
CLASSPATH (This is not needed anymore) -
C:\Program Files\Java\jdk1.7.0_10
C:\Program Files\Java\jdk1.7.0_10\lib;
If you get an output like below for java, then java is correctly configured.
If you get an output like below for java, then java is correctly configured.
2. Download eclipse [any version and variant would do]
- There is no installation needed to run eclipse, just put the extracted eclipse folder in the directory 'C:\ToolDirectory' and you are ready to run
3. Download the selenium java bindings from the selenium HQ
- Extract the zip and put that in the directory 'C:\ToolDirectory'. Lets follow a convention of naming the selenium folder like 'selenium-2.4.2'. Now place all the jar files under the selenium folder [there are usually 2 jar files that are extracted out in a seperate folder].
4. Fire up eclipse
- Create a new java project, like 'se-auto'
- Under the src folder create folder structure like src\main\java and src\test\java
- Associate all external selenium jars with the project
Thats all, you are all set!
Some DONTs -
- Dont create a PATH var, but only Path - otherwise have seen issues with maven config
- JAVA_HOME should not end with bin
- JAVA_HOME cannot have "\" or ";" in the end.
- ";" should not be there at all
- Ensure that the bit-architecture of the JDK and Eclipse is same - either both are 32-bit or both 64-bit - but not different. The OS bit-version can be anything, but now a days mostly everything is 64-bit, so ensure that you have the 64-bit trio for OS, JDK and Eclipse
Common Troubleshooting -
- If you are still having issues, even after following the above steps correctly, first restart the machine before doing any more troubleshooting
- View all Env Parameters -
- To view and dump all the Env params to a file use the following command on CMD:
- set >> AllEnvParam.txt
- To view all the Java Properties use: java -XshowSettings:properties -version
- If you have installed the Java Add-in for QTP, then this can cause issues, and not let eclipse and other java dependent programs start. You may get an error that the JVM is incompatible or that the older version of java is not supported. If you don't need the Java Add-in, uninstall it, or remove the Env Variables that are being used.
- Some of the other Env Variables like those below cause conflicts and can be delete
- _JAVA_OPTIONS
- IBM_JAVA_OPTIONS
- JAVA_TOOL_OPTIONS
- _classload_hook
- If you have Oracle SQL Developer installed, then the Oracle JDK may be added to the JAVA_HOME Env param. Delete the value of the Oracle JDK from JAVA_HOME and ensure that only Java JDK is mentioned there, and nothing else.
- If you have IntelliJ IDEA also installed, then point the 'IDEA_JDK' also to the JAVA_HOME
- Error - 'Failed to load JNI shared library' - This occurs when the JDK and Eclipse have different bit-architectures. This can also be resolved by adding JAVA_HOME\bin to the start of the Path Variable. A very common resolution suggested for this is to specify the location of the javaw.exe in the eclipse.ini file, but it is not needed if we use the above approach.
No comments:
Post a Comment