Ejemplo n.º 1
0
    def logOut(self):

        logInfo("Gmail_Compose : logOut()")
        self.profilePic.click()
        time.sleep(3)

        # visible only after click()
        self.driver.find_element_by_link_text("Sign out").click()
Ejemplo n.º 2
0
def composeGmail(driver, mailto, subject, content):

    c = Gmail_Compose(driver)
    c.sendEmail(mailto, subject, content)

    logInfo("Sleep for few seconds")
    time.sleep(3)

    c.logOut()
Ejemplo n.º 3
0
def signinGmail(driver, userid, password):

    logInfo("siginGmail() ")
    g = Gmail_SigninUserID(driver, userid)
    g.submitUserID()

    logInfo("Sleep for few seconds")
    time.sleep(3)

    g1 = Gmail_SigninPassword(driver, password)
    g1.submitPassword()
Ejemplo n.º 4
0
def getUserLogin():

    logInfo("initSetup()")

    logInfo("Retrieve userid/password from excel")
    f = "C:\\2018\\edureka\\selenium\\INPUT\\gmail_input.xlsx"
    sh = ReadExcel(f, 'Sheet1')
    userid = sh.get_data('A1')
    password = sh.get_data('B1')
    #logInfo("userid : " + userid + " password : " + password)

    return (userid, password)
Ejemplo n.º 5
0
    def sendEmail(self, mailto, subject, content):

        logInfo("Gmail_Compose : sendEmail()")
        self.composeBtn.click()
        time.sleep(10)

        # visible only after click()
        self.driver.find_element_by_name("to").send_keys(mailto)
        self.driver.find_element_by_name("subjectbox").send_keys(subject)
        self.driver.find_element_by_xpath("//*[@id=\":nk\"]").send_keys(
            content)
        self.driver.find_element_by_xpath("//*[@id=\":m5\"]").click()
Ejemplo n.º 6
0
def main():

    userdata = getUserLogin()
    print(userdata)

    driver = startChromeBrowser()

    logInfo("Test-1 : siginGmail() ")
    signinGmail(driver, userdata[0], userdata[1])

    logInfo("Sleep for few seconds")
    time.sleep(10)

    logInfo("Test-2 : composeGmail() and logOut() ")
    mailto = "*****@*****.**"
    subject = "Automated Gmail test"
    content = "This is an email sent via Selenium."
    composeGmail(driver, mailto, subject, content)

    browserClose(driver)
    logInfo("DONE!")
Ejemplo n.º 7
0
def browserClose(driver):
    
    logInfo("browserClose()")
    
    logInfo("Close browser")
    driver.close()
Ejemplo n.º 8
0
def browserSetup(driverPath, url):
    
    logInfo("browserSetup()")
    
    logInfo("Start Chrome webdriver")
    driver = webdriver.Chrome(executable_path=driverPath)
    
    logInfo("Set Page load timeout 30 sec")
    driver.set_page_load_timeout(30)
    
    logInfo("Set Implicitly Wait timeout 15 sec")
    driver.implicitly_wait(15)
    
    logInfo("Navigate to URL : " + url)
    driver.get(url)
    
    logInfo("Maximize Window")
    driver.maximize_window()

    return driver
Ejemplo n.º 9
0
def main():

    logInfo("Retrieve userid/password from excel")
    f = "C:\\2018\\edureka\\selenium\\INPUT\\gmail_input.xlsx"
    sh = ReadExcel(f, 'Sheet1')
    userid = sh.get_data('A1')
    password = sh.get_data('B1')
    logInfo("userid : " + userid + " password : "******"C:\\2018\\Python\\selenium\\chromedriver.exe"
    url = "https://www.gmail.com/"
    driver = browserSetup(driverPath, url)

    g = Gmail_SigninUserID(driver, userid)
    g.submitUserID()

    logInfo("Sleep for few seconds")
    time.sleep(3)

    g1 = Gmail_SigninPassword(driver, password)
    g1.submitPassword()

    logInfo("Sleep for few seconds")
    time.sleep(10)

    mailto = "*****@*****.**"
    subject = "Automated Gmail test"
    content = "This is an email sent via Selenium."

    c = Gmail_Compose(driver)
    c.sendEmail(mailto, subject, content)

    logInfo("Sleep for few seconds")
    time.sleep(3)

    c.logOut()
    logInfo("DONE!")
Ejemplo n.º 10
0
    def submitPassword(self):

        logInfo("Gmail_SigninPassword : submitPassword()")
        self.passWORD.send_keys(self.password)
        self.nextBtn.click()
Ejemplo n.º 11
0
    def submitUserID(self):

        logInfo("Gmail_SigninUserID : submitUserID()")
        self.userID.send_keys(self.userid)
        self.nextBtn.click()