Category Archives: FAQ

Maven Troubleshooting Tips and FAQs

I’ve released a lot of videos showing how to get started with Maven and Selenium. They tend to help people see that the actions are possible, but if they run across an individual issue for their environment they may not know exactly what to do.

On my Selenium WebDriver course I had a list of Maven Troubleshooting Hints and Tips.

I’ve just released that to Slideshare as a pdf.

Pretty simple stuff, but I’ve had to do all of these.

The biggest thing I always encourage people to do when they encounter a problem? Try and solve the problem yourself. Don’t immediately run to someone for help.

When you try and solve the problem yourself, you learn a bit more about the tool. You learn how it works and hangs together. You force yourself to experiment and immediately overcome that ‘but if I touch it, it might break’ response.

I listed the tips in the most common order that I have to follow them. So if you have just started with Maven, and have hit a stumbling block – try working through these.

Shared on Google Docs.


Posted in FAQ, Maven, Selenium Simplified Blog | 1 Comment

Maven Proxies and Troubleshooting 404 errors

Maven is one of those tricky little tools that I avoided moving to, because it looked a little complicated with its xml file and declarative nature, whereas with Ant it was nice and procedural and easy to understand.

I’ve grown to appreciate how simple maven allows me to keep my project, and I often avoid libraries that don’t publish themselves as maven dependencies because then I have to manage them myself.

But, sometimes when I’m setting up a new install I forget how little information a user receives to help debugging, when using it.

A couple of days ago I setup maven. The environment variables M2, M2_HOME all failed to work properly because of machine security settings I think. I tend not to waste time debugging this stuff any more, I’ll stick an absolute path in for all the variables, and add the absolute path to the PATH itself. IntelliJ didn’t pick up maven automatically so I added it manually into the IntelliJ config.

And when I ran a “mvn clean” I got download issues.

I visited the url in the repo through the browser and received a 404, which initially made me think that the file was missing, but in reality I had to amend the settings.xml and add a proxy.

The settings.xml is in maven install directory

<proxy>
   <id>myproxy</id>
   <active>true</active>
   <protocol>http</protocol>
   <host>123.123.123.123</host>
   <port>80</port>
   <nonProxyHosts></nonProxyHosts>
</proxy>

 Note I just made up the host IP

Note I just made up the host IP address there.

If you need to you can add a username and password in there as well.  But try without it first.

      <username>proxyuser</username>
      <password>proxypass</password>

My Full Online WebDriver course has some Maven FAQ and Troubleshooting tips available as free preview content, and the proxy stuff is actually covered in the 3rd lecture listed below:

  • Maven FAQs and Troubleshooting Tips
  • Maven Troubleshooting Downloads
  • Maven Troubleshooting Proxies and Download Cache Issues

There is a useful post on StackOverflow that describes the maven proxy fix:

 

Posted in FAQ, Maven, Selenium Simplified Blog | Leave a comment

What do Eclipse, JUnit, Maven, Ant, etc. do?

I periodically receive FAQ style questions. But I haven’t created an FAQ page… yet.

Recently there have been an influx of people on the free “Start Using Selenium WebDriver With Java” course, and they are a little confused by the amount of software they install.

Now the course does explain a little about what the software does when using them but the course hasn’t provided an overview… until now.

The text summary follows below the video:


We have some mandatory installs:

  • Selenium WebDriver
  • Java JDK
  • Firefox
  • JUnit

We install the Java JDK because we are writing and compiling Java code.

We install Firefox because Selenium WebDriver comes bundled with all the necessary drivers for Firefox so that becomes our default first browser to automate because Selenium WebDriver makes it easy to get started with Firefox out of the box.

We have to install Selenium WebDriver, otherwise we can’t automate anything. And when we use Maven, we don’t actually need to install it, we define it as a dependency, but if we use Ant we have to do additional work to install it.

We have to install JUnit because we use that as our default Test Runner and without it we can’t run any tests. And again, when we use Maven, we don’t actually need to install it, we define it as a dependency, but if we use Ant we have to do additional work to install it.

The course has some Optional installs. You can follow the course completely without these. But they make it easier for me to work in windows, and make it clearer when I’m recording the videos, the actions that I’m doing.

  • Command Line Replacements instead of cmd: Console2 and ConEmu
  • Rapid Environment Editor instead of the default Windows Environment property editing dialog, which can be hard to see what changes have been made.

These are completely optional, and you don’t need to install them.

We need some sort of build system. Either:

  • Ant
  • Maven

You choose one, and only need to install one. I recommend Maven.

With Maven, you declare WebDriver and JUnit as dependencies in the project configuration file, the pom.xml, and maven will download those dependencies for you.

With Ant, again you have to declare the dependencies in a build.xml configuration file. But you also need to download and install Selenium WebDriver, and JUnit.

So maven makes it easier when you are getting started as you have a few less things to worry about getting right.

You need to install one of the IDEs:

  • IntelliJ
  • Eclipse

I recommend IntelliJ as people seem to have fewer out of the box issues with IntelliJ.

The Eclipse install and setup can vary between machines and beginner’s don’t need the additional hassle of trying to figure out why things aren’t working.

IntelliJ seems to work out of the box more easily.

So, your choice:

  1. Optionally install the helper tools,
  2. Install a JDK,
  3. Install Firefox,
  4. Choose which build system you want Ant, or Maven
    1. If you choose Ant then you will need to download Selenium WebDriver and JUnit
    2. If you use Maven, then you will configure maven to download Selenium WebDriver and JUnit for you
  5. Choose and install one IDE (I recommend IntelliJ)

Hopefully this helps people only follow the parts of the introductory course that they need to.

 

Posted in Courses, FAQ, Java, Selenium Simplified Blog, WebDriver | 4 Comments

How to practice Selenium WebDriver FAQs

I receive a fair few emails from people asking if they can have the code to the web pages in my training and what other sites they can use to practice on. So consider this an FAQ post.

Question 1: Can you have my code?

Yes, I released it as open source

Please don’t use it to train people, but for personal use and practice. Knock yourself out.

Question 2: What do you practice on?

For some reason, people seem to practice on Google.com a lot. I don’t recommend this because it keeps changing, and they probably run A/B tests so sometimes you get one setup and another time a different one. When you are starting you want to use something simple.

Having said that, Simon and I did use Google in our WebDriver tutorial for Eurostar, and you can see the code for that on Simon’s github account.

I like to use the GWT Showcase, because it has some remarkably gnarly output, and it doesn’t seem to change too often.

In fact I liked it so much that I wanted a cut down version to help people practise on that wasn’t so heavyweight on the install side. So created a smaller clone, which has some deliberately horribly code for automating against.

 

Posted in FAQ, Links, Selenium Simplified Blog, WebDriver | Leave a comment