It's important to understand the difference between the two. The former is a isn't automating an actual browser, like the latter. Understanding the difference between the two is important as (pending other considerations) your code could be simplified considerably in terms of overheads, dependencies, portability etc.