how to automate google Signup form in selenium using python

selenium

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

1
Answers

Replies

The below code would help in the automation of the Google signup form.


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

If you want to unleash your potential in this competitive field, please visit the selenium course page for more information, where you can find the selenium tutorials and selenium frequently asked interview questions and answers as well.

 

This topic has been locked/unapproved. No replies allowed

Login to participate in this discussion.

Leave a reply

Before proceeding, please check your email for a verification link. If you did not receive the email, click here to request another.
To Top