how to automate google Signup form in selenium using python

+1 vote
i am new to selenium .how to automate google Signup form in selenium using python.can somebody can give me the code? any link or any resource .i did not find on google.
thanks in advance .please consider my Question
Mar 21 in Selenium by umair
• 150 points
116 views

1 answer to this question.

+1 vote

Try the following code: 

from selenium.webdriver import Chrome, ChromeOptions
import time

EMAIL_ID = "<your email ID>"

def slow_typing(element, text):
   for character in text:
      element.send_keys(character)
      time.sleep(0.3)

# Visit chrome://version/ and copy profile path in place of '<chrome user profile>'
options = ChromeOptions().add_argument("--user-data-dir=<chrome user profile>")

browser = Chrome(chrome_options=options)
browser.get('http://gmail.com')

time.sleep(2)

# to accept cookie notification so that it doesn't interfere
cookie_cta = browser.find_element_by_id('accept-cookie-notification')
cookie_cta.click()

# Navigate to Signup Page
button = browser.find_element_by_id('signupModalButton')
button.click()

time.sleep(2)

# Fill user's full name
username = browser.find_element_by_id('user_fudll_name')
# username.send_keys('John Doe')
slow_typing(username, 'John Doe')

time.sleep(1)
# Fill user's email ID
email = browser.find_element_by_id('user_email_login')
slow_typing(email, EMAIL_ID)

time.sleep(2)
# Fill user's password
password = browser.find_element_by_id('user_password')

# Reads password from a text file because
# it's silly to save the password in a script.
with open('password.txt', 'r') as myfile:
       Password = myfile.read().replace('\n', '')
slow_typing(password, Password)

time.sleep(1)
# click on Terms and Conditions
toc = browser.find_element_by_name('terms_and_conditions')
toc.click()

# click on signup page
signupbutton = browser.find_element_by_id('user_submit')
signupbutton.click()

time.sleep(20)

browser.close()
answered Mar 23 by Sirajul
• 50,440 points

Related Questions In Selenium

0 votes
1 answer

How to upload a resume to a website using selenium in python?

Use this code, this will help you: from ...READ MORE

answered Apr 20, 2018 in Selenium by Vardy
• 2,370 points
1,188 views
+9 votes
15 answers

How to automate gmail login process using selenium webdriver in java?

Check the below code: Here is the working ...READ MORE

answered Apr 24, 2018 in Selenium by Vardy
• 2,370 points
96,529 views
0 votes
1 answer

How to Check if any alert exists in selenium using Python

This might work for you. It did ...READ MORE

answered May 10, 2018 in Selenium by king_kenny
• 3,710 points
5,517 views
0 votes
2 answers

How to get HTML Source of WebElement in Selenium WebDriver using Python?

You can read innerHTML attribute to get source of ...READ MORE

answered Jun 13, 2018 in Selenium by Samarpit
• 5,870 points
25,932 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,510 points
2,187 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,870 points
1,813 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,870 points
1,793 views
+2 votes
1 answer

C Sharp with Selenium -- How to Switch one tab to another tab in Csharp selenium

You could use Session.Driver.WindowHandles which is basically to switch ...READ MORE

answered Dec 23, 2019 in Selenium by Sirajul
• 50,440 points
364 views
+3 votes
1 answer

How to read excel file numeric data of all rows and column in selenium? I have 10 rows and 5 column but I read Only String value not a Numeric value?

Hey, @Mahendra, check this thread https://www.edureka.co/community/52170/read-numeric-data-from-excel-sheet-using-selenium-webdriver It deals with ...READ MORE

answered Jan 27 in Selenium by Sirajul
• 50,440 points
199 views