Selenium is a very old project. The original work on it started in 2004. As a result, there have been many changes over the years and, as with all big and old projects, the documentation hasn't always stayed up to date or been as clear as it could be.
If you spend time going through the documentation, you will probably encounter the following:
- Minor errors (such as typos, grammar mistakes, and so on)
- Gaps where some available functionality has never been written about
- Documentation that is either no longer correct or no longer relevant
Documentation always needs to be updated, and there are never enough people to do it. This is the perfect place to start contributing to the Selenium project. The documentation is roughly split into two areas. There is the existing Selenium HQ site, which contains the current documentation (for more information, visit http://docs.seleniumhq.org/docs/). There is also the new documentation project, which was created in 2013. The idea was to start writing the documentation from scratch (visit http://seleniumhq.github.io/docs/ for additional information).
Earlier in this chapter, we cloned a copy of the existing SeleniumHQ website. Hopefully, you have already examined and played around with it a bit. If we now want to take the next step and start contributing, we will need to turn our clone into a fork. The process is very simple.
First of all, go to the GitHub page for the documentation and then click on the Fork button:
GitHub will then do all the work for you. When it has finished, it will load the forked version of the site:
Note that on the right-hand side, you now have your own unique clone URL. There are two things that you can do at this point:
- Delete your existing local copy of the documentation and then clone your fork
- Change your remote to point at the new fork on GitHub
Deleting your local copy is easy. Just go to the parent directory that you originally ran your clone command in and use the following command:
rm -r www.seleniumhq.org git clone <your personal clone url>
You will now have the forked version of the Selenium website cloned. You just need to set up an upstream remote, as shown in the following section.
Let's assume that you have some changes that you don't want to lose. The easiest thing to do in this situation is just change your remote.
We are going to do this in a couple of steps. First of all, we need to have a look at what we currently have set up in Git. We can do this by using the following command to list our remotes:
git remote -v
You will get something that looks like this:
We are going to change the existing remote to upstream. This will allow us to pull down any changes that are made in SeleniumHQ's copy of the code:
git remote add upstream https://github.com/SeleniumHQ/www.seleniumhq.org.git
If you check your remotes again, you will now have an upstream and an origin both pointing at the same thing:
Now, if you want to get your fork up-to-date with SeleniumHQ's copy of the code, all you need to do is use the following command:
git fetch upstream git rebase upstream/master
This will pull down the latest code from the origin and then rebase it onto your current branch (in this case, origin/master).
The final step is to change our remote to point at the fork. First, copy the clone URL for your fork and then run the following command:
git remote set-url origin
[email protected]:Ardesco/www.seleniumhq.org.git
Your remotes should now look like this:
You are now ready to make changes to the documentation. When you are happy with a change, you can create a pull request to submit it back to the Selenium developers.
So far, we have been looking at the old site. Also, we did briefly mention earlier that there is a new documentation project. If you want to add documentation, this is probably the best place to start. To do this, you will need to clone the new documentation project (for more information, visit https://github.com/SeleniumHQ/docs.git).
The process is basically identical to the one that we followed to clone the Selenium website. Once you are done, you are all ready to make changes to the document. Why not start updating the documentations and creating pull requests today?