How to automate google Signup form in Selenium using Python?

SeleniumAutomation TestingTesting Tools

We can automate Google Signup form with Selenium webdriver in Python. To automate this page, we have to first launch the Google Signup page and identify each element on the form.

Let us have a look at the Google Signup form −

Example

from selenium import webdriver
#set chromodriver.exe path
driver = webdriver.Chrome(executable_path="C:\\chromedriver.exe")
#implicit wait
driver.implicitly_wait(0.5)
#launch URL
driver.get("https://accounts.google.com/signup")
#identify elements within form
f = driver.find_element_by_id("firstName")
f.send_keys("Test")
l = driver.find_element_by_id("lastName")
l.send_keys("One")
u = driver.find_element_by_id("username")
u.send_keys("test124ewin")
p = driver.find_element_by_name("Passwd")
p.send_keys("test124@")
c = driver.find_element_by_name ("ConfirmPasswd")
c.send_keys("test124@")
#get value entered
s = f.get_attribute("value")
t = l.get_attribute("value")
v = u.get_attribute("value")
w = p.get_attribute("value")
print("Values entered in form: ")
print(s)
print(t)
print(v)
print(w)
#submit form
b = driver.find_element_by_class_name("VfPpkd-LgbsSe")
b.click()
#browser quit
driver.quit()

Output

raja
Published on 08-Apr-2021 11:24:03
Advertisements