Integrating Selenium with Google Drive

Listen on the go!

New-age technologies have extensively and quite positively impacted our routine activities. Today, there are sophisticated and advanced gadgets available to further ease human efforts. While emerging technologies continue to transform our lives, testing their performance for the desired outcome is indispensable. 

Test automation holds numerous advantages in enhancing the testing processes and achieving maximum test coverage. Selenium Google Drive integration is a case in point. We shall further discuss and understand the various advantages of Integrating Selenium with Google Drive. 

When you integrate with the User Interface (UI) of Google Drive, users can create, and open files stored on the drive within the application. This process is applicable across all the Google Drive Web applications.  

The Google Drive platform provides a bunch of APIs (Application Programming Interfaces) along with client libraries, language-specific examples, and documentation to help you develop apps that can integrate with Google Drive for automation. 


Why is using Google Drive for Test Automation recommended? 

  • You can create an external file that stores the test data (Input data and Expected Data) as a centralized and shared repository. 
  • You can populate the test data into Automation Test Script so that several APIs can be used to read the test data. 
  • The total number of scripts required to cover all the possible combinations of test scenarios is small. Thus, a lesser amount of code is required to test a complete set of scenarios. 
  • You get increased flexibility and maintainability of automation test scripts, which also offers a clean and user-friendly interface. 
  • Any change in the test data matrix would not hamper the test script code. 
  • It provides effective communication and sharing so that it is easier for manual and automation test teams to execute the scripts on the Cloud with a required set of data. 
  • Check-in or check-out from the project framework is not required to refactor the test data. 
  • High re-usability can be achieved, as tests can be reused across multiple test cases by altering the test data values. 

Challenges of using Google Drive for Test Automation 

  • To avoid script-processing errors due to incorrect data file format or content, Notepad or Microsoft Excel must be used to create and maintain the data files. 
  • While developing and executing automation test scripts, technical skills are required to refactor the test data sheet within the Automation framework. 

Prerequisites for Integration 

  • Java 1.7 or greater 
  • Access to the internet and a web browser 
  • A Google account with Google Drive enabled 

Google Drive Configuration 

  1. Login into your Gmail account like and navigate to the Access Link in another tab.
  2. Click on “Google API (Application Programming Interfaces) Console” under Developer Consoles section at bottom of the page or navigate to link – 
  3. Click on “Drive API” under Google Apps APIs section.

Google Apps APIs

4.Create/Select a project in the Google Developers Console and enable the Google API. Click Continue, then Go to credentials.

Google API 4

5.At the top of the page, select the OAuth consent screen tab. Select an Email address, enter a Product name if not already set,                             and click Save.

Image credentials - 5

    6. Select the Credentials tab, click Create Credentials and select OAuth client ID.

7. Now to create Client Id, click on ‘Configure consent screen’.

8. Select the application type other, enter the name “client Demo”, and click Create.

9. Now dialog will appear which shows your “OAuth Client Id and Client Secret”. Click OK to dismiss the resulting dialog.


10. Select the client name checkbox and click the file download (Download JSON) button to the right of the client ID.

11. Move the downloaded file to your working directory and rename it client_secret.json.


12. Now click on “Create credentials” drop down button and select “Service Account Key”.

13. Select “Service Account – Compute Engine default service account” and key type “P12”. Click Create.

14. Click Close to dismiss the resulting dialog.

15. Move the downloaded file – *.P12 to your working directory.


16. Open Google Drive from your Gmail account.

17. Create a new Google spreadsheet and save it as testSheet.

18. Click Share and share the spreadsheet with your Client Id ( which you  created above.

19. Modify the Access Link setting – “Anyone with the link can edit”

20. Click Save.

Java Source Code for Integration 

Here is sample Java code for any user who wants to access Google Drive. First, download the following jars or add maven dependencies to use them download the following jars or add maven dependencies to use the same. 

Jar Files 

  • Extract the downloaded folder and add the following jars in your project: 
  • google-api-client-1.20.0.jar 
  • google-api-client-jackson2-1.20.0.jar 
  • google-http-client-1.20.0.jar 
  • google-oauth-client-1.20.0.jar 
  • google-oauth-client-java6-1.20.0.jar 
  • google-oauth-client-jetty-1.20.0.jar 
  • jetty-6.1.26.jar 
  • jetty-util-6.1.26.jar 











Google Drive is the most user-friendly storage option, where all test data can be loaded (For e.g., on Gmail, Google Docs, and spreadsheets), and accessed from all remote locations. Google provides both free and paid-for storage services. These provide multiple storage capacity options for your files and folders, where users can store backup local files and sync in files and folders across multiple computers. 

It is recommended that Google Drive services be utilized for quality assurance (QA) practices and further integrated with automation tools like Selenium. 

Selenium is one of the most popular Automation testing suites. It is designed to test functional aspects of Web applications across a wide range of browsers and platforms. Considering that it is an open-source platform, it is easy to integrate Google Drive with Selenium. Additionally, credentials for Google accounts can be shared with all authorized team members to effectively execute tests on the cloud.

Ashish Jain technical lead at Cigniti TechnologiesAbout the Author: Ashish Jain, Technical Lead at Cigniti technologies, brings with him rich experience in the field of automation for web and mobile-based applications. He has extensive expertise in both functional as well as performance automation. He also holds expertise across various automation tools and technologies and has been involved in designing Testing solutions for various clients in Energy Utilities, Donation and fitness-based domains.


  • Cigniti Technologies

    Cigniti is the world’s leading AI & IP-led Digital Assurance and Digital Engineering services company with offices in India, the USA, Canada, the UK, the UAE, Australia, South Africa, the Czech Republic, and Singapore. We help companies accelerate their digital transformation journey across various stages of digital adoption and help them achieve market leadership.

    View all posts

Comments (3)

  • Walter B DuquedeEstrada

    Could you make the source code example available?

    October 5, 2016 at 4:42 PM
  • Admin

    Please send a note to marketing @ Cigniti. Net

    October 28, 2016 at 7:04 PM
  • Harika

    We can user google spreadsheet api v4 which is more easier and don’t requires much code. Google Sheets API use the OAuth 2.0 protocol for authentication and authorization

    Check out below website for example on how to integrate spreadsheet for selenium tests using Google Sheets latest API.

    September 24, 2017 at 9:17 PM

Leave a Reply

Your email address will not be published. Required fields are marked *