Here are the steps necessary to set up a GitHub repository with the files provided through the Selenium Essential Training course and have it work as a Java project inside IntelliJ. The idea is to take the files provided by the course and add them into a GitHub repository. You will then clone the repository onto your local system and perform the first exercise. The first exercise represents a change to your source tree. You could file an issue on GitHub and submit your solution as a fix to the issue.
This text ist written from the perspective of MacOS.
[button] - is a button on the screen with the text 'button' on it.
InputField: - is a field labeled 'InputField:', where you can enter text.
<PlaceHolder> - a placeholder to be replaced with your own text (without the '<' and '>').
[v] Label1 - ensure there is a check mark in front of the label 'Label1'
[x] Label2 - ensure there is an 'x' in the check box in front of the label 'Label2'
1/3 - step 1 of in total 3 steps
$ - prompt for a regular user
# - prompt for the root user (system administrator)
- Open IntelliJ
- [New Project]
- Java
- [Next]
- [Next]
- Project name: SeleniumEssentialTraining
- [Finish]
- Go to the GitHub page of the team leader (If it is just you, you are the team leader):
https://github.com/<team lead> - In the top, black bar click on the + sign
- Select 'New repository'
- Match the name with local project:
SeleniumEssentialTraining
- Provide a Description
Exercise files for the LinkedIn course Selenium Essential Training
- [v] Add a README file
- Click [Create repository]
- Capture the URL:
https://github.com/<team lead>/SeleniumEssentialTraining
Make room to clone the GitHub directory and temporary rename (not delete) your project directory
$ mv SeleniumEssentialTraining SeleniumEssentialTraining.Project
P.S. There is an alternative way of solving this, by renaming, rebasing the local repository. For details refer to the gist https://gist.github.com/tcd1558/a838deda7dd5968bab6c3d88b9aa466d
- Go back to IntelliJ
- Close the window, which opened when you created your new IntelliJ Java project SeleniumEssentialTraining
- You will see, that your project SeleniumEssentialTraining is grayed out (because you renamed it).
- Let's clean up this entry in the project list by clicking it.
- You will get a notification stating
The path <your path> does not exist. If it is on a removable or network drive, please make sure that the drive is connected.
- Click [Remove From List]
- In the window 'Welcome to IntelliJ IDEA', click on the top, right button [Get from VCS]
- In the window 'Get from Version Control', click on [GitHub]
- ***What if you have not signed in yet - needs edit ***
- [PyCharm], [Preferences], [GitHub], [+], [Login via GitHub...]
- [PyCharm], [Preferences], [Appearance], [System Settings], [Passwords]
- Do not save, forget passwords after restart
- [Log in via GitHub...]
- URL: https://github.com/<team lead>/SeleniumEssentialTraining
- Directory: /Users/<user>/IdeaProjects/SeleniumEssentialTraining
- [Clone]
- Close the IntelliJ Project Window and leave the window 'Welcome to IntelliJ IDEA'
- Make a copy of the just cloned directory for backup.
$ cp -r SeleniumEssentialTraining SeleniumEssentialTraining.GitHub
- Add the IntelliJ misc.xml, SelenumEssentialTraining.iml file
$ cp SeleniumEssentialTraining.Project/.idea/misc.xml SeleniumEssentialTraining/.idea
$ cp SeleniumEssentialTraining.Project/.idea/SelenumEssentialTraining.iml SeleniumEssentialTraining/.idea
$ echo "/out/
/chromedriver_mac64.zip
/Ex_Files_Selenium_EssT.zip
/selenium-java/selenium-java-3.141.59.zip" >SeleniumEssentialTraining/.gitignore
- Create the src direcory:
$ mkdir SeleniumEssentialTraining/src
- In the window 'Welcome to IntelliJ IDEA', select/open the SeleniumEssentialTraining project.
Select the <my_project> directory Right click Git Add
or
$ git add .
or
$ git add --all
Right click on the project SeleniumEssentialTraining or the src directory
Git
Commit Directory...
A Changelist pops up
In the lower part of the Commit window, provide a Commit Message:
"Initial Check-in of the SeleniumEssentialTraining files"
Click [Commit]
or
$ git commit -m "Initial Check-in of the SeleniumEssentialTraining files"
Right Click on the project Git Push or Shift+CMD+K Push
or
$ git push
- Add the chromedriver
$ cp <Downloads>/chromedriver_<my_architecture>.zip SeleniumEssentialTraining
- Add selenium-java.zip
$ mkdir SeleniumEssentialTraining/selenium-java
$ cp <Downloads>/selenium-java/selenium-java-3.141.59.zip SeleniumEssentialTraining/selenium-java
Hint: to see the content of a zip file use:
$ unzip -l <zipfile>
The chromedriver is not inside a directory, when unzipping. This is fine, since it is only one file.
The selenium-java files are not inside a directory, when unzipping. Since these are several files, unzip this file inside the selenium-java directory.
- unzip all zip files using:
$ unzip <zipfile>
Refresh IntelliJ with:
Right click the project
Reload from Disk
First, exercize 06_0x need JUnit. The prepare the environment for all tests, let's first download the JUnit jar file. Below is the chain of links and documents to download the JUnit jar files. I hope this is useful to find your way around, when the chain changed. You can also just click on the Maven Central link.
Use Shift+Click to open below links in another window
https://junit.org/junit5/
Click on Code & Issues (GitHub) - https://github.com/junit-team/junit5/
https://github.com/junit-team/junit5/README.md
User Guide - https://junit.org/junit5/docs/current/user-guide/
1.4 Getting Started - https://junit.org/junit5/docs/current/user-guide/#overview-getting-started
1.4.1 Download JUnit Artifacts - https://junit.org/junit5/docs/current/user-guide/#dependency-metadata
10.2 Dependency Metadata - Maven Central - https://search.maven.org/
Maven Central - search for 'junit' The search results are sorted by release date. Click on the Download icon (last column) to download the jar file. Move the junit-4.13.2.jar file to SeleniumEssentialTraining/selenium-java, so all needed jar files are in one location.
$ mv ~/<Downloads>/junit-4.13.2.jar SeleniumEssentialTraining/selenium-java
Add all jar files to the IntelliJ libraries with:
- Highlight the Project
- File > Project Structure (or CMD+;)
- Project Setting > Libraries > click on the '+' in the middle pannel
- New Project Library > Java
- A file explorer window pops up. Navigate to selenium-java
- Select all .jar libs/.jar files (using CMD+click), click on [open], click on [ok]
- When all of them are listed, click on [ok]
- Add Ex_Files_selenium_EssT.zip
$ cp <Downloads>/Ex_Files_Selenium_EssT.zip SeleniumEssentialTraining
Hint: to see the content of a zip file use:
$ unzip -l <zipfile>
The Ex_Files_Selenium_EssT.zip files are stored inside a directory, when unzipping.
Note: The directory struction of the exercise files contains 3 problems:
- There is a directory with a space in the name. Java can not handle this properly
- The examples are inside directories, whose name starts with a number. Java has problems with this as well.
- When you start doing the first exercise and you try to run your java code, IntelliJ tries to compile all the java
Addressing problem 1:
Move the exercise directories to the src directory created when you created the IntelliJ project
$ mv SeleniumEssentialTraining/Ex_Files_Selenium_EssT/Exercise\ Files/* SeleniumEssentialTraining/src
Addressing problem 2: Put a prefix of letters in front of all the exersise directories:
$ cd SelentiumEssentialTraining/src
$ for DIR in `ls -d [0-9][0-9]_[0-9][0-9]`
do
mv $DIR Ex_$DIR
done
Some exercizes come with an iml file. They need to be adjusted to the new directory name:
$ cd SelentiumEssentialTraining/src
$ mv ./Ex_02_02/.idea/02_02.iml ./Ex_02_02/.idea/Ex_02_02.iml
$ mv ./Ex_05_03/.idea/05_03.iml ./Ex_05_03/.idea/Ex_05_03.iml
Addressing problem 3: Hide all java exercise files by renaming them until you get to them.
$ cd SelentiumEssentialTraining/src
$ for FILE in ` find . -name \*.java `
do
mv $FILE $FILE.org
done
Modify all java.org files to reflect the location of your chromedriver.
If you followed the above instructions, your chromedriver can be found under:
~/IdeaProjects/SeleniumEssentialTraining/chromedriver
*** work in progress ***
$ cd SelentiumEssentialTraining/src
$ for FILE in ` find . -name \*.java `
do
echo $FILE
done
Refresh IntelliJ with:
Right click the project
Reload from Disk
Tag your branch, so you can always get back to this point of the repository.
$ git tag v1.0
exercises, not exercizes