from selenium import webdriver
from selenium.webdriver.support.select import Select

driver = webdriver.Chrome("E:\chrome driver\chromedriver_win32\chromedriver.exe")
driver.maximize_window()
driver.get("https://www.irctc.co.in/nget/profile/user-registration")
driver.find_element_by_xpath("(//button[@type='submit'])[1]").click()
driver.find_element_by_name("userName").send_keys("sonu")
driver.find_element_by_name("usrPwd").send_keys("Google@123")
driver.find_element_by_name("cnfUsrPwd").send_keys("Google@123")
driver.find_element_by_xpath("//label[text()='Select Security Question']").click()
driver.find_element_by_xpath("//li//span[text()='What was the name of your first school?']").click()
driver.find_element_by_xpath("//input[@placeHolder='Security Answer']").send_keys("RMHS")
driver.find_element_by_xpath("//label[text()='Select Preferred Language']").click()
driver.find_element_by_xpath("//li//span[text()='English']").click()
driver.find_element_by_id("firstName").send_keys('sonuthegreat')
driver.find_element_by_id("middleName").send_keys('shashank')
driver.find_element_by_id("lastname").send_keys('garime')
radio_buttons =driver.find_elements_by_xpath('//input[@type="radio"]')
radio_buttons[0].click()
radio_buttons[4].click()
select1 = Select(driver.find_element_by_xpath("//select[@formcontrolname='resCountry']"))
select1.select_by_visible_text("India")
driver.find_element_by_id("email").send_keys('sonu@gmail.com')
driver.find_element_by_id('mobile').send_keys('8343492345')
select1 = Select(driver.find_element_by_xpath("//select[@formcontrolname='nationality']"))
select1.select_by_visible_text("India")
driver.find_element_by_id("resAddress1").send_keys('Flat no:3')
driver.find_element_by_id('resAddress2').send_keys('road no 34')
driver.find_element_by_id('resAddress3').send_keys('chaitanyapoooori')
driver.find_element_by_name("resPinCode").send_keys('500060')
driver.find_element_by_name('resState').send_keys('Telengana')
select3 = Select(driver.find_element_by_xpath("//select[@formcontrolname='resCity']"))
select3.select_by_visible_text('RANGAREDDY')
select4 = Select(driver.find_element_by_xpath("//select[@formcontrolname='resPostOff']"))
select4.select_by_index(0)
driver.find_element_by_id('resPhone').send_keys('983432380')
radio_buttons[6].click()
