# -*- coding: utf-8 -*- from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import Select from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import NoAlertPresentException import unittest, time, re
class test (unittest.TestCase): def setUp(self): self.driver = webdriver.Chrome() self.driver.implicitly_wait(30) self.base_url = "http://test.robotscloud.com/" self.verificationErrors = [] self.accept_next_alert = True
def test_(self): driver = self.driver driver.get(self.base_url + "/#") driver.find_element_by_link_text(u"忘记密码").click() driver.find_element_by_id("submit-find-back").click() driver.find_element_by_id("email").clear() driver.find_element_by_id("email").send_keys("123456789@163") driver.find_element_by_id("submit-find-back").click() driver.find_element_by_id("email").clear() driver.find_element_by_id("email").send_keys("123456789@163.com") driver.find_element_by_id("submit-find-back").click() driver.find_element_by_id("authcode").clear() driver.find_element_by_id("authcode").send_keys("3333") driver.find_element_by_id("submit-find-back").click() driver.find_element_by_css_selector("img.captcha-img").click() driver.find_element_by_id("email").click() driver.find_element_by_id("email").clear() driver.find_element_by_id("email").send_keys("") driver.find_element_by_id("submit-find-back").click() driver.find_element_by_id("email").click() driver.find_element_by_id("email").clear() driver.find_element_by_id("email").send_keys("cylan_123@@163.com") driver.find_element_by_id("submit-find-back").click() driver.find_element_by_id("email").clear() driver.find_element_by_id("email").send_keys("cylan_123@163.com") driver.find_element_by_id("authcode").clear() driver.find_element_by_id("authcode").send_keys("333") driver.find_element_by_id("submit-find-back").click() driver.find_element_by_id("authcode").clear() driver.find_element_by_id("authcode").send_keys("") driver.find_element_by_id("submit-find-back").click() driver.find_element_by_id("authcode").clear() driver.find_element_by_id("authcode").send_keys("3333") driver.find_element_by_id("submit-find-back").click() driver.find_element_by_id("to-login-email").click() driver.find_element_by_id("email").clear() driver.find_element_by_id("email").send_keys("cylan_123@163.com") driver.find_element_by_id("authcode").clear() driver.find_element_by_id("authcode").send_keys("7616") driver.find_element_by_id("submit-find-back").click() driver.find_element_by_id("login-email").click() time.sleep(3) driver.switch_to_frame("x-URS-iframe") time.sleep(3) driver.find_element_by_name("email").clear() driver.find_element_by_name("email").send_keys("cylan_123") driver.find_element_by_name("password").clear() driver.find_element_by_name("password").send_keys("cylan123456") time.sleep(3) driver.find_element_by_id("dologin").click() time.sleep(3) driver.find_element_by_id("_mail_tree_1_68count").click() driver.find_element_by_css_selector("span.da0").click() driver.find_element_by_link_text(u"立即重置密码").click()
怎么定位这个立即重置密码 不要定位链接 driver.find_element_by_id("_mail_tree_1_68count").click() driver.find_element_by_css_selector("span.da0").click()这两句是不是我以后进来它定位的都是邮箱中的第一封邮件 还是指定的某个邮件 因为这个在页面上看不到页面元素 所以不知道是什么意思 能帮忙解答下么 |