Friday, July 15, 2016

AUTOMATION 15 - GUI 3, introducing Selenium WebDriver

Technical level: **

Through some of these next few posts I'm going to flag up the technical level I believe I'm going to.  This is about 2/5.  I think everyone who is a tester and works with or alongside automation will benefit from.

So far we've looked at identifying page elements, and some very basic manipulation of page elements using Tamper Monkey.  This should be increasing our comfort and sense of "hands on" with the automation.

For the next few sections we'll be looking at Selenium WebDriver, and some tests we can do within this framework.  I'm hoping that by the end of this series you'll understand why we're focusing on Web Driver - over Selenium IDE, which is record and playback.

In a nutshell...

Driven by common computer languages

Selenium WebDriver is powered by a computer language - you can download it on multiple languages such as Java, C#, Ruby, Python.  In this series I'm focusing on Java.

We will also explore by series end why that's incredibly useful.

An API tool

Selenium WebDriver is an API tool - but it's somewhat different to the API's we've looked at previously.  It uses API commands to remote control your browser, and retrieve information from it.  In the examples we've looked at before, we used API commands to remote control part of your test system.  As such, testing with Selenium means we're testing with a complete system under test (your users browser is always external to your system).

Firefox out of the box, but other browsers are available

Out of the box, Selenium WebDriver works on Firefox.  You might be aware that Firefox is updated quite frequently, and likewise Selenium WebDriver has to be updated to keep pace.

In preparing an example, I was unable to get a very simple case to work - turns out my Firefox browser needed an update, and without it Selenium just wouldn't communicate!

Support for other browsers such as Chrome are available, including headless browsers.  Headless browsers such as PhantomJS don't have a graphical interface and return page information in pure html form.  This is really handy for an API driven system like Selenium, which doesn't really need that visual element.  It means if you run your automation with a headless browser, you can perform it much faster as it's stripped down to the bare minimum, such browsers work much faster than say Firefox.  Against that you're not able to screenshot when you have an issue.

I won't be going into any more detail about headless browsers, but if you're interested, you should do further reading.

Looking at Selenium, the commands available fall into several broad categories.  I believe it's useful for testers to be aware of these, even if they don't actually script it, because when you ask your automator to create automation for scenarios for you, you need to be work within these kinds of commands.

Page Manipulation

These kind of commands are a continuation of those we explored previously using TamperMonkey (although we use a different language here).

They are a set of commands to simulate us "doing" something to the page such as,

  • Entering test into a field
  • Selecting a radio button
  • Selecting/deselecting a checkbox
  • Choosing an option from a dropdown box
  • Pressing a button
Browser control

There are a host of controls which simulate some very basic commands, pretty much anything you can do with your controls in the top band of your browser there's a command for maximise/minimise, read the URL you're on, close/quit, go back.

One of the most useful functions is the navigate command, which takes your browser to the URL you provide.  This is obviously typically step 1 of most tests!

Capture web element

These kind of commands typically get Selenium to "locate" at an area of the web page, from details you provide (such as the ID we used last time).  

Once located, you can run checks on the content at that location - for instance you might open a page, and see if it ever makes a reference to the text "blue aardvark" for instance.

Explicit wait

After issuing a command using Selenium, you have to wait for the browser to respond.

When I was doing "old-style" automation back in 1999, we typically set a wait of about 2 seconds a command to cover this.  These days we want the script to run as fast as possible.

Selenium uses something called an explicit wait - it waits for an event to occur (which you define), it that happens, it will wait up to a time you determine, before moving on anyway.  [Trust me, you don't want to wait indefinitely]

Next time we'll look into installing everything you need for Selenium WebDriver, before moving on to some basic examples.

Extension material

I am using a host of material to prepare this section - primarily sourcing the WebDriver support pages here and here.  I've learned though such pages move around a lot, so be prepared to use Google for a search if this post is quite old.  Hopefully reading this series will help you get more out of those support pages, which I encourage you to visit and read as we work through some examples.

Engel Consulting runs a great course on Selenium WebDriver, and they have provided me support in putting together this series.

Ministry Of Testing has some a useful collection of videos with Richard Bradshaw, but they require membership - which although might seem expensive, talk to your company about (it's an on-demand learning resource, cheaper than sending on a course).


  1. I agree with your post. Selenium is most used automation tool to test web application and browser. This automation tool offers precise and complete information about a software application or environment. Selenium Training in Chennai

  2. I am following your blog from the beginning, it was so distinct & I had a chance to collect conglomeration of information that helps me a lot to improvise myself.
    testing training in chennai|Software training institutes in chennai

  3. Really awesome blog. Your blog is really useful for me. Thanks for sharing this informative blog. Keep update your blog. Selenium Training in Chennai

  4. really you have posted an informative blog it will be really helpful to many peoples. thank you for sharing this blog.
    selenium training in chennai

  5. Nicely explained. Here you described the well written article from your in-depth knowledge. Truly impressive and nice information

    Java Training in Chennai Core Java Training in Chennai Core Java Training in Chennai

    Java Online Training Java Online Training JavaEE Training in Chennai Java EE Training in Chennai


  6. This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
    Android Training in Chennai
    Ios Training in Chennai

  7. The blog gave me idea about selenium web driver My sincere thanks for sharing this post and please Countinue To share this kind of post
    Selenium Training in Chennai

  8. This article is so informatic and it really helped me to know more about the Selenium Testing. This selenium article helps the beginners to learn the best training course. So keep updating the content regularly.
    Selenium Training in Chennai | Best Selenium Training institute in Chennai | Selenium Course in Chennai

  9. really you have posted an informative blog. it will be really helpful to many peoples. so keep on sharing such kind of an interesting blogs. before i read this blog i didn't have any knowledge about this but now i got some knowledge.
    selenium training in chennai

  10. Hello Admin,
    I really enjoyed while reading your article, the information you have mentioned in this post was damn good. Keep sharing your blog with updated and useful information.

    Selenium Training in Bangalore

  11. This blog is very well good as i am working in selenium sector it is really useful for me. so please update latest kind of information too. Software Testing Training in Chennai | Salesforce Training in Chennai

  12. This comment has been removed by the author.

  13. This is an awesome post.Really very informative and creative contents.Thanks to sharing these concept is a good way to enhance my knowledge. I like this site very much.I like it and help me to develop my knowledge very well.Thank you for this brief explanation....
    Java Training in chennai |Python Training in Chennai|Best Python Training in Chennai

  14. hi admin.i am really love it your blog.Because your explanation wise all the topics are too good.I got enough knowledge from your blog.Thanks for sharing more..
    Software Testing Training in Bangalore
    Dot Net Training in Chennai

  15. Wonderful information on recent technology. Keep following my profile to know about

    the Software courses like Selenium testing.

    Selenium Training in Velachery |
    Selenium Course in Chennai

  16. This is an awesome post.Really very informative and creative contents. These concept is a good way to enhance the knowledge.I like it and help me to development very well.
    Software Testing Training in Bangalore

    Software Testing Training in BTM Layout

    Software Testing Training in Marathahalli

  17. I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here. Thanks once more for all the details.

    selenium training in bangalore|

  18. Gclub Create a moment of fun, entertainment.

    G club Online casino site of the famous online gambling in Asia. Online casino gambling is considered to be one of the starting point and a good investment of the casino industry and for investing in online gambling games, the site is considered as a good investment for people with horoscopes and people who are. Betting Opportunities

    Playing online casino games with online casinos is considered an investment that is not wasted, because your investment will be able to grow and profit for you well. The online betting site is also a new way to make money and to pocket money just to play games online with us only. It is known that making money on the site of the online casino is easy and that you can easily access it as well.

    So if you are thinking about playing online gambling games, do not forget to check out our online casino site. Because fun and money are what you can set. Gclub มือถือ

  19. Nice blog has been shared by you. before i read this blog i didn't have any knowledge about this but now i got some knowledge so keep on sharing such kind of an interesting blogs.

    automation testing courses online

  20. Very Helpful Post And Explained Very Clearly About All the things.Very Helpful. Coming To Our Self We Provide Food Service Parts Through Out US At Very Affordable Prices And Also We Offer Same Day Shipping In US.We Offer Only Genuine Products.Really Thanks For Posting Such an useful Content.

  21. Really It's A Great Pleasure reading your Article,learned a lot of new things,we have to keep on updating it,Primary Care Chicago .By getting them into one place.Really thanks for posting.Very Thankful for the Informative Post.Really Thanks For Posting.

  22. It is exceptionally valuable data. It will enhance my insight in Selenium. Much thanks to you for sharing this marvelous site.
    Selenium training Chennai | Selenium testing training in Chennai | Best selenium training in Chennai | Selenium classes in Chennai

  23. It's A Great Pleasure reading your Article, learned a lot of new things, we have to keep on updating it Bala Guntipalli Thanks for posting.

  24. Thank you for sharing beneficial information nice post USMLE

  25. Thanks for sharing the valuable information to share with us For more valuable information please visit our website.

    selenium training in chennai

    aws training in chennai

  26. Really Tanks For Sharing Such an Important Post...

    Vizag Real Estate

  27.      Thanks a lot very much for the high quality and results-oriented help. I won’t think twice to endorse your blog post to anybody who wants and needs support about this area.

    ccna training in chennai

    ccna training in bangalore

    ccna training in pune

  28. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    java training in chennai | java training in bangalore

    java training in tambaram | java training in velachery

    java training in omr

  29. I really appreciate the kind of topics you post here. Thanks for sharing us a great information that is actually helpful.
    Selenium Training Chennai
    software testing selenium training
    selenium testing training in chennai
    Best selenium training in chennai

  30. Thank you for allowing me to read it, welcome to the next in a recent article. And thanks for sharing the nice article, keep posting or updating news article.
    python online training
    python training in OMR
    python training course in chennai

  31. Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
    Devops training in sholinganallur
    Devops training in velachery
    Devops training in annanagar
    Devops training in tambaram

  32. Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.

    rpa interview questions and answers
    automation anywhere interview questions and answers
    blueprism interview questions and answers
    uipath interview questions and answers
    rpa training in chennai

  33. I enjoy what you guys are usually up too. This sort of clever work and coverage! Keep up the wonderful works guys I’ve added you guys to my blog roll.
    best safety course in chennai

  34. Good job in presenting the correct content with the clear explanation. The content looks real with valid information. Good Work

    DevOps is currently a popular model currently organizations all over the world moving towards to it. Your post gave a clear idea about knowing the DevOps model and its importance.

    Good to learn about DevOps at this time.

    devops training in chennai | devops training in chennai with placement | devops training in chennai omr | devops training in velachery | devops training in chennai tambaram | devops institutes in chennai | devops certification in chennai | trending technologies list 2018

  35. Nice Post. Looking for more updates from you. Thanks for sharing.

    Guest posting sites

  36. I want to thank you for this great blog! I really enjoying every little bit of it and I have you bookmarked to check out new stuff you post.
    website designing training
    web designing training
    web designing in chennai
    PHP Training in Chennai
    PHP Course in Chennai
    PHP Training Institute in Chennai