{"id":2673,"date":"2016-09-29T14:53:10","date_gmt":"2016-09-29T14:53:10","guid":{"rendered":"http:\/\/www.gallop.net\/blog\/?p=1690"},"modified":"2022-07-25T13:15:54","modified_gmt":"2022-07-25T07:45:54","slug":"integrating-selenium-with-google-drive","status":"publish","type":"post","link":"https:\/\/www.cigniti.com\/blog\/integrating-selenium-with-google-drive\/","title":{"rendered":"Integrating Selenium with Google Drive"},"content":{"rendered":"
New-age technologies have extensively impacted our routine activities and quite positively. Today there are sophisticated and advanced gadgets available to further ease human efforts. While the emerging technologies continue to transform our lives, testing their performance for desired outcome is indispensable.<\/p>\n
Test Automation<\/a> holds numerous advantages to enhance the testing processes and achieve maximum test coverage. Google Drive integration is a case in point. We shall further discuss and understand the various advantages of using Google Drive.<\/p>\n 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 along with client libraries, language-specific examples, and documentation to help you develop apps that can integrate with Google Drive for automation.<\/p>\n <\/p>\n Why is using Google Drive for Test Automation recommended?<\/strong><\/p>\n Challenges of using Google Drive for Test Automation<\/strong><\/p>\n Prerequisites for Integration<\/strong><\/p>\n Google Drive Configuration<\/strong><\/p>\n <\/p>\n <\/p>\n <\/p>\n 6. Select the\u00a0Credentials<\/strong> tab, click Create Credentials<\/strong>\u00a0and select\u00a0OAuth client ID.<\/p>\n 9. Now dialog will appear which shows your \u201cOAuth Client Id and Client Secret\u201d. Click\u00a0OK<\/strong>\u00a0to dismiss the resulting dialog.<\/p>\n <\/p>\n 10. Select the client name checkbox and click the\u00a0file download\u00a0(Download JSON) button to the right of the client ID.<\/p>\n <\/p>\n 12. Now click on \u201cCreate credentials\u201d drop down button and select \u201cService Account Key\u201d.<\/p>\n 14. Click\u00a0Close <\/strong>to dismiss the resulting dialog.<\/p>\n <\/p>\n 16. Open Google Drive from your Gmail account.<\/p>\n 17. Create a new Google spreadsheet and save it as testSheet<\/strong>.<\/p>\n 18. Click Share<\/strong> and share the spreadsheet with your Client Id (xxx-developer.gsserviceaccount.com<\/em>) which you\u00a0 created above.<\/p>\n 19. Modify the Access Link setting \u2013 \u201cAnyone with the link can edit\u201d<\/p>\n 20. Click Save<\/strong>.<\/p>\n Java Source Code for Integration<\/u><\/strong><\/p>\n Here is a sample code in Java for accessing the Google Drive for any user. To use the same, first download the following jars or add maven dependencies.<\/p>\n Jar Files<\/u><\/strong><\/p>\n\n
\nuser-friendly interface.<\/li>\n\n
\n
\n
\n
\n
\n
\n
\n
\n7. Now to create Client Id<\/strong>, click on \u2018Configure consent screen\u2019.<\/p>\n
\n8. Select the application type\u00a0other, enter the name “client Demo”, and click Create<\/strong>.<\/p>\n
\n11. Move the downloaded file to your working directory and rename it\u00a0client_secret.json.<\/p>\n
\n13. Select \u201cService Account \u2013 Compute Engine default service account\u201d and key type \u201cP12\u201d. Click Create<\/strong>.<\/p>\n
\n15. Move the downloaded file – *.P12 to your working directory.<\/p>\n