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).

100 comments:

  1. 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

    ReplyDelete
  2. 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

    ReplyDelete
  3. 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

    ReplyDelete
  4. 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

    ReplyDelete
  5. 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

    ReplyDelete
  6. 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



    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. 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

    ReplyDelete
  9. 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

    ReplyDelete
  10. 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

    ReplyDelete
  11. 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




    ReplyDelete
  12. 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|

    ReplyDelete
  13. 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

    ReplyDelete
  14. 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.

    ReplyDelete
  15. 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.

    ReplyDelete
  16. 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

    ReplyDelete
  17. Thank you for sharing beneficial information nice post USMLE

    ReplyDelete
  18. Really Tanks For Sharing Such an Important Post...

    Vizag Real Estate

    ReplyDelete
  19.      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

    ReplyDelete
  20. 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

    ReplyDelete
  21. 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

    ReplyDelete
  22. 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

    ReplyDelete
  23. Nice Post. Looking for more updates from you. Thanks for sharing.

    eiffeltowerfacts
    Guest posting sites

    ReplyDelete
  24. 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

    ReplyDelete
  25. Wonderful blog!!! Thanks for your information… Waiting for your upcoming data.

    atstartups
    Education

    ReplyDelete
  26. Thanks you for sharing this unique useful information content with us. Really awesome work. keep on blogging
    apple service center | apple iphone service center | apple ipad service center | apple mac service center

    ReplyDelete

  27. You are doing a great job. I would like to appreciate your work for good accuracy
    Regards,
    Data Science Course in Chennai | Data Science Training Institute

    ReplyDelete
  28. Very nice post here thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great content of different kinds of the valuable information's.
    machine learning training in chennai
    best training insitute for machine learning
    machine learning course in Chennai

    ReplyDelete
  29. Thanks For sharing Your information The Information Shared Is Very Valuable Please Keep updating Us Time Just Went On Redaing The Article Python Online Course Devops Online Course Data Science Online Course Aws Science Online Course

    ReplyDelete
  30. Nice article i was really impressed by seeing this article, it was very interesting and it is very useful for me.I get a lot of great information from this blog. Thank you for your sharing this informative blog.
    Devops Training in Chennai | Devops Training Institute in Chennai

    ReplyDelete
  31. Thanks for sharing this information admin, it helps me to learn new things. Continue sharing more like this.
    Regards,
    Tableau training in Chennai | Tableau Courses Training in Chennai | Tableau training Institute in Chennai

    ReplyDelete
  32. You Are doing a great job. I would like to appreciate your work for good accuracy
    R Language Training in Chennai

    ReplyDelete
  33. Hey, would you mind if I share your blog with my twitter group? There’s a lot of folks that I think would enjoy your content. Please let me know. Thank you.
    IT Institute in KK Nagar| Data Science Training in chennai | data science course in chennai | data science Training Institute in Chennai

    ReplyDelete

  34. Cool! It was really a nice blog. Thanks for the provided information.
    selenium classes in pune hadapsar

    ReplyDelete
  35. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing.

    aws tutorial videos

    ReplyDelete
  36. Thanks you for sharing this unique useful information content with us...
    Best AWS with Devops Training in Bangalore | AWS with Devops Training Course Content | AWS with Devops Training Institutes | AWS with Devops Online Training - Elegant IT Services
    - Elegant IT Services provides Best AWS with Devops Training in Bangalore with expert real-time trainers who are working Professionals with min 8 + years of experience in AWS with Devops Training Industry, we also provide 100% Placement Assistance with Live Projects on AWS with Devops Training.

    ReplyDelete
  37. Good Post and informative one. Thank you for sharing. Selenium Classes in Pune Hadapsar

    ReplyDelete
  38. I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic.

    sap fico online training
    sap fico training videos

    ReplyDelete
  39. It's Very useful and the topic is clear understanding.  Keep sharing.   Primavera course online   Primavera p6 training online   

    ReplyDelete
  40. Did you want to set your career towards Amazon Web Services? Then Infycle is with you to make this into your life. Infycle Technologies gives the combined and best Big AWS Training in Chennai, along with the 100% hands-on training guided by professional teachers in the field. In addition to this, the interviews for the placement will be guided to the candidates, so that, they can face the interviews without struggles. Apart from all, the candidates will be placed in the top MNC's with a great salary package. To get it all, call 7502633633 and make this happen for your happy life.Best AWS Training in Chennai

    ReplyDelete
  41. Thanks for sharing this wonderful information. I too learn something new from your post..
    Node JS Training in Chennai

    ReplyDelete
  42. There is obviously a lot to know about this. I think you made some good points in Features also. Keep working, great job!
    data scientist training and placement in hyderabad

    ReplyDelete
  43. The Blog contains the effective and attractive information’s and thanks for the blog.
    JAVA Training in Chennai
    JAVA Training in Bangalore

    ReplyDelete
  44. largest companies by market cap. As an investors we have to think not in binary terms but in probabilities and The acceleration of our debt issuance and our government’s seeming indifference to it and to ballooning budget deficits raise the probability and the likely severity of inflation. jp morgan chase market cap and at&t market cap

    ReplyDelete
  45. Title:
    Best Software Training Center in Chennai | Infycle Technologies

    Description:
    Want to set your career towards the software field? Then join hands with Infycle Technologies to make this into reality. Infycle Technologies, the best software training institute in Chennai, gives the combined and best software training in Chennai, with various stages of multiple courses such as Big Data, Python, Data Science, Oracle, etc., which will be guided by professional tutors in the field. The Hands-on practical training and the mock interview sessions will be given to the candidates to face the interviews with full confidence. Apart from all, the candidates will be placed in the top MNC's with the highest salary package in the market. To get it all, call 7502633633 and make this happen for your happy life.
    Best training in Chennai

    ReplyDelete
  46. I was basically inspecting through the web filtering for certain data and ran over your blog. I am flabbergasted by the data that you have on this blog. It shows how well you welcome this subject. Bookmarked this page, will return for extra. data science course in jaipur

    ReplyDelete
  47. This blog is very attractive and impressive.

    ReplyDelete
  48. Real Time Campaigns
    We will demonstrate you the live campaigns that we run on Doubleclick in real time. Our trainers shall show you the campaign in real time.

    ReplyDelete
  49. Hi! I was perusing your website and wanted to drop a note that I really liked it. I thought I’d share a site too. You can learn about past life regression there. Check it out if you’re interested. Thanks!!

    야동

    ReplyDelete
  50. here are some hyperlinks to web sites that we link to since we assume they are worth visiting 스포츠토토

    ReplyDelete
  51. Nice weblog here! Additionally your site loads up very fast! 카지노사이트탑

    ReplyDelete
  52. I truly appreciate this article post. Really looking forward to read more. Want more.
    성인야설
    립카페
    출장안마
    스포츠마사지

    ReplyDelete
  53. Thanks for ones marvelous posting! I truly enjoyed reading it, you might be a great author. I will make sure to bookmark your blog and will come back in the future. I want to encourage that you continue your great job, have a nice evening!
    성인야설
    립카페
    출장안마
    스포츠마사지

    ReplyDelete
  54. Hello There. I found your blog using msn. This is a really well
    written article. 토토

    ReplyDelete
  55. Wow! This could be one particular of the most helpful blogs We've ever arrive across on this subject. Basically Magnificent. 카지노사이트

    ReplyDelete
  56. I absolutely love this site. That’s exactly what I’ve been looking for온라인카지노

    ReplyDelete
  57. This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging 스포츠토토

    ReplyDelete

  58. Grab the Oracle Training in Chennai from Infycle Technologies, the best software training and placement center in Chennai which is providing technical software courses such as Data Science, Artificial Intelligence, Cyber Security, Big Data, Java, Hadoop, Selenium, Android, and iOS Development, DevOps, etc with 100% hands-on practical training. Call 7504633633 to get a free demo with more info.

    ReplyDelete
  59. Extremely overall quite fascinating post. I was searching for this sort of data and delighted in perusing this one. Continue posting. A debt of gratitude is in order for sharing.

    ReplyDelete