Sunday, 24 April 2016

Setting up selenium webdriver in Android Studio


Now a days almost all web applications have mobile applications and hence testers prefer to write test suits in one common place. We can setup selenium in Android Studio so that we can write and run our mobile application plus web application test suits at one place.The management and execution of test cases becomes very efficient.

If you agree with me and want to know how to setup Selenium in Android Studio then this blog post is for you. Please fallow the steps one by one and you will be able to complete your setup quickly.

Video Tutorial -



Pre-requisites -
2. Java
3. Set ANDROID_HOME and JAVA_HOME

Selenium WebDriver Setup in Android Studio -

1. Download Selenium Webdriver Java Client from This Link. Extract the folder and store all the jars in c:\seleniumjars\


2. Open your Andriod Studio and Click on Create new project 

3. Enter Application Name and Click on Next


4. Then click on Next after selecting Minimum SDK version.


5.  Select Blank Activity and click Next


6. Click on Finish. 


7. Change project structure from Android to Project.


8. Copy the selenium jars to libs folder


9. Select all jars and right click -> click on Add as Library and let it complete the gradle sync successfully.


10. Go to app -> src -> main -> java . Then right click on the package and click on New  -> Java class
Give the class name and click OK


11. Below is the basic selenium test case to open the website in the browser. Copy this code in your java class.


package com.selenium.tests;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class BrowserTests {

 public static void main(String[] args) throws Exception {
  WebDriver driver=new FirefoxDriver();
  driver.get("http://qaautomated.blogspot.in");
  Thread.sleep(3000);
  driver.quit();
 }

}

12. Click on Build Variants on the left side and change Test Artifacts to Unit Test and we are going to are going to write and run junit test.


13. Then right click on your javaclass and click on run.


You can see that Test Case launches firefox browser and opens the given link.  Now you have sucessfully configured Android Studio with Selenium WebDriver and ran your first Test case.

In case if you have any questions or doubts do post in comments. I will try my level best to answer your queries.


Note - Learn More About Android Studio Functionality Usage HERE.

114 comments:

  1. Excellent sharing. Testing is a wonderful field for IT peoples. Want to learn Selenium Training reach GangBoard. Hadoop Training

    ReplyDelete
  2. We have provided the practical training in the real time scenarios. Our trainers have strong knowledge in this field.
    Android Training in Chennai |
    Android Training in Chennai |
    Android Training in Chennai | Android Training in Chennai |

    ReplyDelete
  3. Thanks for this blog. provided great information. All the details are explained clearly with the great explanation. Thanks for this wonderful blog. Step by step processes execution is given clearly.Know the details about the different thing.
    Selenium Training in Chennai | Selenium Course in Chennai | Selenium Testing Training in Chennai

    ReplyDelete
  4. Hi, I am really happy to found such a helpful and fascinating post that is written in well manner. Thanks for sharing such an informative post. keep update your blog. R Programming Online Training

    ReplyDelete
  5. Hi!Thanks for your post. I would like to change my local test for selenium ones but I'm getting an issue that can't resolve:

    Error:Gradle: warning: Ignoring InnerClasses attribute for an anonymous inner class
    Error:Gradle: (org.apache.commons.el.ImplicitObjects$1) that doesn't come with an

    Does someone know how to solve? Thanks!

    PD: I think that I have follow this post correctly

    ReplyDelete
  6. hi welcome to this blog. really you have post an informative blog. it will be really helpful to many peoples. thank you for sharing this blog.
    java training in chennai

    ReplyDelete
  7. The blog gave me idea to setup selenium web driver in android studio Thanks for sharing it
    Selenium Training in Chennai

    ReplyDelete
  8. Wonderful suggestions and guidance thanks a lot for the useful information's.
    python training in chennai

    ReplyDelete
  9. Hi, like you post its more informative and thanks for sharing with us.
    Graphic design course in chennai

    ReplyDelete
  10. Thank you for Sharing. Brave Technologies is a leading low cost erp software solution providers in chennai. For more details call +91 9677025199. cloud erp in Chennai

    ReplyDelete
  11. please share source code android studio .
    thanks

    ReplyDelete
  12. Amazing blog about the various informative information on the programming languages. Java Training in Chennai

    ReplyDelete
  13. I want to shine in a Selenium field, so I am looking the information related to selenium. Your blog really have some more useful information about testing. Keep your blog with testing updates…
    Regards,
    Selenium Training in Chennai
    Dot Net Training in Chennai

    ReplyDelete
  14. You are doing a great job. You inspire me to write for other. Thank you very much. I would like to appreciate your work for good accuracy and got informative knowledge from here. Selenium Training in Chennai

    ReplyDelete
  15. Thanks for posting useful information.You have provided an nice article, Thank you very much for this one. And i hope this will be useful for many people.. and i am waiting for your next post keep on updating these kinds of knowledgeable things...Really it was an awesome article...very interesting to read..
    please sharing like this information......
    Android training in chennai
    Ios training in chennai


    ReplyDelete
  16. Your blog really have some more useful information about testing. Keep your blog with testing updates…
    Regards,
    Selenium Training in Chennai
    Dot Net Training in Chennai

    ReplyDelete


  17. Thanks for posting useful information.You have provided an nice article, Thank you very much for this one. And i hope this will be useful for many people.. and i am waiting for your next post keep on updating these kinds of knowledgeable things...Really it was an awesome article...very interesting to read..
    please sharing like this information......
    Android training in chennai
    Ios training in chennai

    ReplyDelete
  18. It's interesting that many of the bloggers your tips helped to clarify a few things for me as well as giving.. very specific nice content. And tell people specific ways to live their lives.Sometimes you just have to yell at people and give them a good shake to get your point across.
    Web Design Company
    Web Development Company
    Mobile App Development Company

    ReplyDelete
  19. Thanks for such awesome blog. Your article is very easy to understand, informative and provide complete overview about software testing. Keep sharing... want to learn selenium source reach us Selenium Training in Chennai | Software Testing Training in Chennai

    ReplyDelete
  20. Nice it seems to be good post... It will get readers engagement on the article since readers engagement plays an vital role in every blog.. i am expecting more updated posts from your hands.
    Mobile App Development Company

    ReplyDelete
  21. great and nice blog thanks sharing..I just want to say that all the information you have given here is awesome...Thank you very much for this one.
    web design Company
    web development Company
    web design Company in chennai
    web development Company in chennai
    web design Company in India
    web development Company in India

    ReplyDelete
  22. Hi, the information you provided here is very informative and useful for me. If anyone interested to learn Selenium Training in Bangalore.


    Selenium Training in Bangalore

    ReplyDelete
  23. Really cool post, highly informative and professionally written and I am glad to be a visitor of this perfect blog, thank you for this rare info!

    Android Online Training

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

    ReplyDelete
  25. Excellent blog really Nice article ,thanks for sharing Android Online Training

    ReplyDelete
  26. I have read your blog and i got a very useful and knowledgeable information from your blog.You have done a great job . If anyone want Android Training in Bangalore , Please visit our page Android Training in Bangalore

    ReplyDelete
  27. great and nice blog thanks sharing..I just want to say that all the information you have given here is awesome...Thank you very much for this one.
    web design Company
    web development Company
    web design Company in chennai
    web development Company in chennai
    web design Company in India
    web development Company in India

    ReplyDelete
  28. Everyone wants to get unique place in the IT industry’s for that you need to upgrade your skills, your blog helps me improvise my skill set to get good career, keep sharing your thoughts with us.

    selenium training in bangalore|
    python training in bangalore|

    ReplyDelete
  29. Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here. Besant technologies Marathahalli

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

    ReplyDelete
  31. Existing without the answers to the difficulties you’ve sorted out through this guide is a critical case, as well as the kind which could have badly affected my entire career if I had not discovered your website.
    "aws training in marathahalli"

    ReplyDelete
  32. Enjoyed reading the article above , really explains everything in detail,the article is very interesting and effective.Thank you and good luck for the upcoming articles

    PSD to Wordpress
    wordpress website development

    ReplyDelete
  33. Howdy a dedication of gratefulness is all together for the amazing offer and it will be basic for a couple of individuals who are looking for after down best site building affiliation or so far working with page sorting out company.We in like way give quality Web Design and Web change advantage at sensible cost .

    top web developer services in bangalore
    expert of professional eCommerce Website developers companies in bangalore

    ReplyDelete
  34. Interesting post! This is really helpful for me. I like it! Thanks for sharing!
    Mobile application developers in Chennai | PHP developers Chennai

    ReplyDelete
  35. Enjoyed reading the article above , really explains everything in detail,the article is very interesting and effective.Thank you and good luck for the upcoming articles
    mobile website builder

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

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


    java training in chennai


    java Training in Bangalore



    big data Training in Bangalore


    ReplyDelete
  38. 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.selenium training in chennai.

    ReplyDelete
  39. I wish to show thanks to you just for bailing me out of this particular trouble.As a result of checking through the net and meeting techniques that were not productive, I thought my life was done.


    java training in bangalore

    ReplyDelete
  40. Those guidelines additionally worked to become a good way to recognize that other people online have the identical fervor like mine to grasp great deal more around this condition.

    java training in bangalore

    ReplyDelete
  41. Informative blog and it was up to the point describing the information very effectively. Thanks to blog author for wonderful and informative post.
    Mobile application developers in Chennai | Android application developers in Chennai | Android app developers Chennai | PHP developers chennai

    ReplyDelete
  42. Your new valuable key points imply much a person like me and extremely more to my office workers. With thanks.

    Hadoop online Training \ Informatica Online Training \ ETL Testing Online Training

    ReplyDelete
  43. It was so good to read and useful to improve my knowledge as updated one.Thanks to Sharing.

    UNIX Shell scripting training in chennai \ ORACLE apps finance training in chennai

    ReplyDelete
  44. I have read your blog its very attractive and impressive. I like it your blog.
    Abinitio Online Training | Hadoop Online Training | Cognos Online Training

    ReplyDelete
  45. I have read your blog its very attractive and impressive. I like it your blog.
    PHP Online Training | Pega Online Training | Oracle Soa Online Training

    ReplyDelete
  46. Your definition is very much impressive for me Thanks For sharing about selenium courseSelenium Course Training Institute in Chennai

    ReplyDelete
  47. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here.
    Kindly keep blogging. If anyone wants to become a Java developer learn from Java EE Online Training from India.
    or learn thru Java EE Online Training from India . Nowadays Java has tons of job opportunities on various vertical industry.

    ReplyDelete
  48. Thanks for splitting your comprehension with us. It’s really useful to me & I hope it helps the people who in need of this vital information. Selenium Training in Chennai | Selenium Training institutes in Chennai

    ReplyDelete
  49. Thanks for sharing this niche useful informative post to our knowledge.
    brochure designers in chennai | brochure design company in chennai

    ReplyDelete

  50. Well Said, you have furnished the right information that will be useful to anyone at all time. Thanks for sharing your Ideas.

    software testing training in chennai

    ReplyDelete
  51. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
    java training in chennai

    ReplyDelete
  52. I wish to show thanks to you just for bailing me out of this particular trouble.As a result of checking through the net and meeting techniques that were not productive.
    Best selenium training Institute in chennai

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

    white label website builder

    ReplyDelete
  54. 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.
    aws training in chennai

    ReplyDelete
  55. Nice post.Thank you so much for sharing.Yiioverflow is a web development company.We have well expert team in Angular JS, Ionic, Yii Framework, Node JS, Laravel, PHP, MySQL, and WordPress.If you want a developer visit.. https://yiioverflow.com/

    ReplyDelete
  56. Thank you and good luck for the upcoming articles mobile website builder.
    Also visit my page: rochester MN web design

    ReplyDelete
  57. Your good knowledge and kindness in playing with all the pieces were very useful.

    Selenium Training In Chennai

    ReplyDelete
  58. Thanks for sharing - It was so good to read and useful 1
    Faribault Web Design

    ReplyDelete
  59. It's interesting that many of the bloggers to helped clarify a few things for me as well as giving.Most of ideas can be nice content.The people to give them a good shake to get your point and across the command.
    advanced java training in chennai | struts training in chennai.

    ReplyDelete
  60. I think this is the best article today. Thanks for taking your own time to discuss this topic, I feel happy about that curiosity has increased to learn more about this topic. Keep sharing your information regularly for my future reference.
    Java Courses in chennai

    ReplyDelete
  61. Thank You for this useful blog!
    Final year project centre is a fast growing company has maintained it is leadership in imparting quality services. We provide the phd projects in chennai and research projects in chennai for all college students. As per their own interest and own requirements we deliver all the projects at right time.

    ReplyDelete
  62. Thank you so much for this good information!
    Dj in Coimbatore

    ReplyDelete
  63. I have just been reading through it and I find it very valuable and informative, thanks for sharing.for information regarding Brochure Designing service please visit to the link.
    How to get Unique Brochure Design Ideas

    ReplyDelete
  64. Much obliged to you such a great amount for this great data!
    Education | Article Submission sites | Technology | Linux Hacks

    ReplyDelete
  65. Woww Thank you for the amazing information u have shared. that was very useful for me. do share more information.

    Click the link to know more exciting information.
    Selenium Training in chennai

    ReplyDelete
  66. Woww Thank you for the amazing information u have shared. that was very useful for me. do share more information.

    Click the link to know more exciting information.
    Selenium Training in chennai

    ReplyDelete
  67. Thank you so much for such valuable information sharing. It’s highly appreciated.

    Microsoft Azure Admin Training in Chennai
    Microsoft Azure Admin Training

    ReplyDelete
  68. This content was very useful and informative. POst more information.
    You can also refer for more job related information

    Selenium Training and Placement

    ReplyDelete
  69. This content was very useful and informative. POst more information.
    You can also refer for more job related information

    Selenium Training and Placement

    ReplyDelete
  70. Thank you this was very informative. Your blog was very useful
    Visit the link once for more crisp information
    Selenium trainnig in chennai

    ReplyDelete
  71. Thank you for the informative blog!! do visit the below link for information.
    Selenium training in chennai

    ReplyDelete

  72. Very Useful Information. Do click for more exciting technology

    Selenium Training in chennai

    ReplyDelete
  73. thanks for your article it is very informative creak the code
    Selenium Training in Chennai

    ReplyDelete
  74. I am really happy with your blog because your article is very unique and powerful for new reader.
    Selenium Training in Chennai

    ReplyDelete
  75. I am definitely enjoying your website. You definitely have some great insight and great stories.
    infinite logo design
    logo design uk
    professional app development

    ReplyDelete

  76. Nice article Thanks for sharing this article Wonderful information from this website Thanks !!!

    Embedded training in chennai | Embedded training centre in chennai

    ReplyDelete
  77. Hello. This post couldn’t be written any better! Reading this post reminds me of my previous roommate. He always kept chatting about this. I will forward this page to him. Fairly certain he will have a good read. Thank you for sharing.
    bigdata training institute in chennai

    ReplyDelete
  78. Your post is really very helpful. Easy to learn as you explain things precisely. Thank you so much.

    Selenium Training in Chennai

    Selenium Training

    ReplyDelete
  79. Amazing post.Thanks for your details and explanations..I want more information from your side.Thank you
    Trading erp software in chennai

    ReplyDelete

  80. PhD Thesis Writing Services https://www.wordsdoctorate.com/

    Dissertation Writing Services https://www.wordsdoctorate.com/dissertation-writing-services/

    Research paper Writing Service https://www.wordsdoctorate.com/journal-papers/

    Master Thesis Writing Service https://www.wordsdoctorate.com/masters/

    thesis writing service https://www.wordsdoctorate.com/phd/

    ReplyDelete
  81. I‘d mention that most of us visitors are endowed to exist in a fabulous place with very many wonderful individuals with very helpful things.
    Click here:
    Online training in USA

    ReplyDelete
  82. Good stuffs from this blog. I got very interesting points in this article Thanks for providing very nice article Such a lovely website !
    Water purifier service in Coimbatore Aquaguard Service Centre in Coimbatore

    ReplyDelete
  83. Wow, Excellent post. This article is really very interesting and effective.you are posting a good information for people and keep maintain and give more update too.

    React Training
    React Training in Chennai

    ReplyDelete
  84. Amazing blog about the various informative information on the programming languages... Java Training in Chennai | Python Training in Chennai

    ReplyDelete
  85. mytectra placement Portal is a Web based portal brings Potentials Employers and myTectra Candidates on a common platform for placement assistance.

    ReplyDelete
  86. It’s great to come across a blog every once in a while, that isn’t the same out of date rehashed material. Fantastic read.

    Android Training
    Android Training in Chennai

    ReplyDelete
  87. Shall we work with TestNG rather than Junit ? . is if possible to add testng lib files ?

    ReplyDelete
  88. Amazing article. Your blog helped me to improve myself in many ways thanks for sharing this kind of wonderful informative blogs in live. I have bookmarked more article from this website. Such a nice blog you are providing ! Kindly Visit Us @ Madurai Travels ! Best Travels in Madurai | Tours and Travels in Madurai

    ReplyDelete
  89. I would like to say thank you for the amazing details and concepts you are sharing in this.The style of writing is excellent and also the content is top-notch. Thanks for that shrewdness you provide the readers!

    Software Testing Training in Chennai
    Software Testing Training

    ReplyDelete
  90. Thanks for providing the information . The articles in your blog helped me a lot for improving the knowledge on the subject. Also check my small collection on this at selenium Online Training blog

    ReplyDelete
  91. Your blog was very interesting & easy to understand. Thank you so much sharing that valuable blog.CFA Audit
    Warehouse Audit
    Customer Reconciliation
    Vendor Reconciliation

    ReplyDelete
  92. Thank you so much for your information!!! Zinavo Technologies provide web design & development with good quality if security in your website. Web Designers in Bangalore | Website Designers in Bangalore | Website Design in Bangalore Bangalore


    ReplyDelete
  93. Amazing Article ! I have bookmarked this article page as i received good information from this. All the best for the upcoming articles. I will be waiting for your new articles. Thank You ! Kindly Visit Us @ Coimbatore Travels | Ooty Travels | Coimbatore Airport Taxi | Coimbatore taxi | Coimbatore Taxi

    ReplyDelete
  94. I am commenting to let you know what a terrific experience my daughter enjoyed reading through your web page. She noticed a wide variety of pieces
    iosh course in chennai

    ReplyDelete