当前位置: 首页>>代码示例>>Python>>正文


Python WebDriverWait.clear方法代码示例

本文整理汇总了Python中selenium.webdriver.support.ui.WebDriverWait.clear方法的典型用法代码示例。如果您正苦于以下问题:Python WebDriverWait.clear方法的具体用法?Python WebDriverWait.clear怎么用?Python WebDriverWait.clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在selenium.webdriver.support.ui.WebDriverWait的用法示例。


在下文中一共展示了WebDriverWait.clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: buyMW

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import clear [as 别名]
    def buyMW(self, company, amount):
        #go to trade website
        self.driver.get("http://www.marketwatch.com/game/alecfongtest2/trade")
        driver = self.driver
        #get Xpath
        companyFieldXpath = ".//*[@id='fakemaincontent']/section/div[1]/div/input"
        searchbuttonXpath = ".//*[@id='fakemaincontent']/section/div[1]/div/button"
        #initialize elements
        compFieldElement = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(companyFieldXpath))
        searchButtonElement = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(searchbuttonXpath))

        compFieldElement.clear()
        #enter company symbol
        compFieldElement.send_keys(company)
        #click to search
        searchButtonElement.click()

        tradeFieldXpath = ".//*[@id='fakemaincontent']/section/div[2]/div/div[3]/div/button[2]"
        tradeFieldElement = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(tradeFieldXpath))
        #click to trade
        tradeFieldElement.click()

        shareamountXpath = "//input[@value='0']"
        submittradeXpath = ".//*[@id='submitorder']/button"
        shareamountElement = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(shareamountXpath))
        submittradeElement = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(submittradeXpath))

        shareamountElement.clear()
        shareamountElement.send_keys(str(amount))
        submittradeElement.click()
开发者ID:theFong,项目名称:market_bot,代码行数:32,代码来源:Browser.py

示例2: login_adriaticapress

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import clear [as 别名]
 def login_adriaticapress(self):
     '''Creazione webdriver e procedura di login in adriatipress
     '''
     try:
         with open('secrets.txt') as credentials_file:
             credentials_file_list = list(credentials_file.readlines())
             username = credentials_file_list[0].strip()[9:]
             password = credentials_file_list[1].strip()[9:]
     except FileNotFoundError:
         self.msg = QMessageBox()
         self.msg.setText('File credenziali non presente')
         self.msg.setWindowTitle('testtitolo')
         self.msg.setStandardButtons(QMessageBox.Ok)
         return self.msg.exec_()
     if os.name == 'nt':
         self.dr = webdriver.Chrome('chromedriver.exe')
     else:
         self.dr = webdriver.Chrome()
     self.dr.maximize_window()
     self.dr.get('{}Login.htm'.format(ip_ap))
     time.sleep(5)
     username_field = WebDriverWait(self.dr, 15).until(EC.presence_of_element_located((By.ID, 'txtUsername')))
     password_field = WebDriverWait(self.dr, 15).until(EC.presence_of_element_located((By.ID, 'txtPassword')))
     username_field.clear()
     username_field.send_keys(username)
     password_field.clear()
     password_field.send_keys(password)
     password_field.send_keys(Keys.RETURN)
     time.sleep(5)
开发者ID:sgrc31,项目名称:AdriaticaPress-scarica-bolla,代码行数:31,代码来源:applus.py

示例3: write_pdf_link

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import clear [as 别名]
def write_pdf_link(pdf_link):
    def _write_pdf_link():
        return (
            'Please, provide an accessible direct link to a PDF document.'
        ) in message_err

    try:
        WebDriverWait(Arsenic(), 5).until(
            EC.visibility_of_element_located((By.ID, 'url'))
        )
    except (ElementNotVisibleException, WebDriverException):
        _skip_import_data()
    field = WebDriverWait(Arsenic(), 5).until(
        EC.visibility_of_element_located((By.ID, 'url'))
    )
    field.send_keys(pdf_link)
    Arsenic().hide_title_bar()
    Arsenic().click_with_coordinates('state-group-url', 5, 5)
    try:
        message_err = WebDriverWait(Arsenic(), 10).until(
            EC.visibility_of_element_located((By.ID, 'state-url'))
        ).text
    except (ElementNotVisibleException, WebDriverException):
        message_err = ''
    Arsenic().show_title_bar()
    field.clear()

    return ArsenicResponse(_write_pdf_link)
开发者ID:fschwenn,项目名称:inspire-next,代码行数:30,代码来源:create_literature.py

示例4: test_Login

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import clear [as 别名]
    def test_Login(self):
        driver = self.driver
        driver.get("https://virgin-red-test.appspot.com/backoffice/#/")
        VirginUsername = "[email protected]"
        VirginPassword = "testing"
        #threeLogoXpath = "//*[@id='ember360']/div[1]/div/div[1]/div/img"

        # FieldID's and Xpath for elements

        emailFieldXpath = "/html/body/div[1]/div/div[2]/div/form/div[1]/input"
        passFieldXpath = "/html/body/div[1]/div/div[2]/div/form/div[2]/input"
        #rememberXpath = "//*[@id='login_form']/div[4]/label"
        loginFieldXpath = "/html/body/div[1]/div/div[2]/div/form/button"

        #WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(threeLogoXpath))
        emailFieldElement = WebDriverWait (driver, 10).until(lambda driver: driver.find_element_by_xpath(emailFieldXpath))
        passFieldElement  = WebDriverWait (driver, 10).until(lambda driver: driver.find_element_by_xpath(passFieldXpath))
        #rememFieldElement  = WebDriverWait (driver, 10).until(lambda driver: driver.find_element_by_xpath(rememberXpath))

        loginFieldElement = WebDriverWait (driver, 10).until(lambda driver: driver.find_element_by_xpath(loginFieldXpath))

        # Login into the application
        emailFieldElement.clear()
        emailFieldElement.send_keys(VirginUsername)
        passFieldElement.clear()
        passFieldElement.send_keys(VirginPassword)
        #rememFieldElement.click()

        loginFieldElement.click()
        print("Login Successfull")
开发者ID:kalpanakapoor11,项目名称:first,代码行数:32,代码来源:VirginLogin.py

示例5: test_Login

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import clear [as 别名]
	def test_Login(self):
		#for i in range(0,846):
		
		driver = self.driver
		facebookUsername = LoginTest.mailData.pop()
		facebookPassword = LoginTest.passwordData.pop()
		emailFieldID     = "email"
		passFieldID      = "pass"
		loginButtonID    = "loginbutton"
		loginButtonXpath = "//input[@value='Log In]"
		fbLogoXpath		 = "(//a[contains(@href, 'logo')])[1]"
		fbLogoId		 = "u_0_e"
		errorMessageClassName = 'pam login_error_box uiBoxRed'

		emailFieldElement  = WebDriverWait(driver, 1).until(lambda driver: driver.find_element_by_id(emailFieldID))
		passFieldElement   = WebDriverWait(driver, 1).until(lambda driver: driver.find_element_by_id(passFieldID))
		loginButtonElement =  driver.find_element_by_id(loginButtonID)

		emailFieldElement.clear()
		emailFieldElement.send_keys(facebookUsername)
		passFieldElement.clear()
		passFieldElement.send_keys(facebookPassword)
		
		#Check if can find fblogo button top left.If true user has logged in
		try:
			WebDriverWait(driver, 5).until(lambda driver: driver.find_element_by_id(fbLogoId))
				
		except TimeoutException:
			print "Login failed"
		else:
			print "login successfull"
开发者ID:kostasPp,项目名称:fbBot,代码行数:33,代码来源:fbBot.py

示例6: sendMessageToSelected

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import clear [as 别名]
def sendMessageToSelected(message):
  element = WebDriverWait(driver, 30).until(EC.element_to_be_clickable((By.TAG_NAME,'swx-textarea')))
  element = element.find_element_by_tag_name("textarea")
  element.click()
  element.clear()
  element.send_keys(message)
  element.send_keys(Keys.ENTER)
开发者ID:SriramKeerthi,项目名称:pySkypeBot,代码行数:9,代码来源:pyskypebot.py

示例7: test_Login

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import clear [as 别名]
    def test_Login(self):
        driver = self.driver
        driver.get("https://wqd-stage.3m.com/3madmin/#/")
        ThreeMUsername = "superadmin"
        ThreeMPassword = "[email protected]"

        # FieldID's and Xpath for elements

        emailFieldID = "username"
        passFieldID = "password"
        rememberXpath = "//*[@id='login_form']/div[4]/label"
        loginFieldXpath = "//*[@id='loginFormSubmit']"

  	WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(threeLogoXpath))
        emailFieldElement = WebDriverWait (driver, 10).until(lambda driver: driver.find_element_by_id(emailFieldID)) 
        passFieldElement  = WebDriverWait (driver, 10).until(lambda driver: driver.find_element_by_id(passFieldID))
        rememFieldElement  = WebDriverWait (driver, 10).until(lambda driver: driver.find_element_by_xpath(rememberXpath))

        loginFieldElement = WebDriverWait (driver, 10).until(lambda driver: driver.find_element_by_xpath(loginFieldXpath))

        # Login into the application
        emailFieldElement.clear()
        emailFieldElement.send_keys(ThreeMUsername)
        passFieldElement.clear()
        passFieldElement.send_keys(ThreeMPassword)
        rememFieldElement.click()

        loginFieldElement.click()
        print("Login Successfull")
开发者ID:kalpanakapoor11,项目名称:first,代码行数:31,代码来源:ThreeMlogin.py

示例8: test_challenge

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import clear [as 别名]
    def test_challenge(self, user, passwd):
        mailstring = user + '@user.com'
        email = WebDriverWait(self, 10).until(lambda self: self.browser.find_element_by_name("email"))
        email.send_keys(mailstring)

        password = self.browser.find_element_by_name("password")
        password.send_keys(passwd)

        submit_button = self.browser.find_element_by_css_selector("#submit_record__row input")

        submit_button.click()
        time.sleep(1)

        #self.url = ROOT + "/viewquest/index/4"
        self.url = functional_tests.questref

        get_browser=self.browser.get(self.url)
        time.sleep(2)
        challreason = WebDriverWait(self, 10).until(lambda self : self.browser.find_element_by_name("challreason"))	
        #self.browser.find_element_by_name("challreason").clear()
        challreason.clear()
        challreason.send_keys("this is just wrong")
        self.browser.find_element_by_xpath("//input[@value='Challenge']").click()

        time.sleep(3)
        #target = self.browser.find_element_by_css_selector("#target")
        #self.assertIn('Challenge accepted', target.text)
        body = WebDriverWait(self, 10).until(lambda self : self.browser.find_element_by_tag_name('body'))
        self.assertIn('Challenge accepted', body.text)

        self.url = ROOT + '/default/user/logout'
        get_browser=self.browser.get(self.url)
        time.sleep(1)
开发者ID:DonaldMc,项目名称:gdms,代码行数:35,代码来源:test_ph3_challengeusr2.py

示例9: write_date_thesis

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import clear [as 别名]
def write_date_thesis(date_field, error_message_id, date):
    try:
        WebDriverWait(Arsenic(), 5).until(
            EC.visibility_of_element_located((By.ID, date_field))
        )
    except (ElementNotVisibleException, WebDriverException):
        _skip_import_data()
        _select_thesis()
    field = WebDriverWait(Arsenic(), 5).until(
        EC.visibility_of_element_located((By.ID, date_field))
    )
    field.send_keys(date)
    Arsenic().hide_title_bar()
    Arsenic().click_with_coordinates('state-group-supervisors', 5, 5)
    try:
        error_message = WebDriverWait(Arsenic(), 5).until(
            EC.visibility_of_element_located((By.ID, error_message_id))
        ).text
    except (ElementNotVisibleException, WebDriverException):
        error_message = ''
    Arsenic().show_title_bar()
    field.clear()

    def _has_error():
        return (
            'Please, provide a valid date in the format YYYY-MM-DD, YYYY-MM '
            'or YYYY.'
        ) in error_message

    return ArsenicResponse(_has_error)
开发者ID:fschwenn,项目名称:inspire-next,代码行数:32,代码来源:create_literature.py

示例10: sellMW

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import clear [as 别名]
 def sellMW(self, company, buylist, amount):
     self.driver.get("http://www.marketwatch.com/game/alecfongtest2/portfolio/Holdings")
     driver = self.driver
     companysellbutXpath = ".//*[@id='maincontent']/section[2]/div[1]/table/tbody/tr[1]/td[7]/button"
     submitsaleXpath = "//div[3]/button"
     sortbysymbolXpath = "//a[contains(text(),'Symbol')]"
     shareamountXpath = "//div[@id='order']/div/div/div[2]/div/div/a/input"
     companysellbutElement = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(companysellbutXpath))
     submitsaleElement = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(submitsaleXpath))
     sortbysymbolElement = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(sortbysymbolXpath))
     shareamountElement = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(shareamountXpath))
     if(company < buylist[0] or company < buylist[1]):
         companysellbutElement.click()
         time.sleep(2)
         shareamountElement.clear()
         shareamountElement.send_keys(amount)
         submitsaleElement.click()
     else:
         sortbysymbolElement.click()
         time.sleep(2)
         companysellbutElement.click()
         time.sleep(2)
         shareamountElement.clear()
         shareamountElement.send_keys(amount)
         submitsaleElement.click()
开发者ID:theFong,项目名称:market_bot,代码行数:27,代码来源:Browser.py

示例11: _login

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import clear [as 别名]
    def _login(self, with_email=False):
        
        jack_user = create_user_jack(active=True)

        browser = self.browser
        
        browser.get(self.site_url + reverse('login'))

        input_login = WebDriverWait(browser, 10).until( lambda browser: browser.find_element_by_xpath("//input[@id='id_email_or_username']"))

        input_password = WebDriverWait(browser, 10).until( lambda browser: browser.find_element_by_xpath("//input[@id='id_password']"))
        
        input_login.clear()
        if with_email:
            input_login.send_keys(jack_user.email)
        else:
            input_login.send_keys(jack_user.username)
    
        input_password.clear()
        input_password.send_keys('pass')
        
        submit_button = WebDriverWait(browser, 10).until( lambda browser: browser.find_element_by_xpath("//input[@type='submit']"))
        
        submit_button.click()
        
        return jack_user
开发者ID:nirvaris,项目名称:nirvaris-profile,代码行数:28,代码来源:test_selenium.py

示例12: setHostname

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import clear [as 别名]
    def setHostname(self, name, desc):
        driver = self.driver
        hostname=name
        
        #Change to the Settings tab in a Microhard
        settingButtonXpath = "//a[@href='/cgi-bin/webif/system-settings.sh']"
        settingButtonEle = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(settingButtonXpath))
        settingButtonEle.click()
        
        #Change Hostname Field
        hostnameFieldXpath = "//input[@name='hostname']"
        hostanmeFieldElement = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(hostnameFieldXpath))
        hostanmeFieldElement.clear()
        hostanmeFieldElement.send_keys(hostname)

        fieldXpath = "//input[@name='description']"
        fieldElement = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(fieldXpath))
        fieldElement.clear()
        fieldElement.send_keys(desc)
        
        
        #Submit the change, like a commit
        commitFieldXpath = "//a[@href='#'][@id='waitbox']"
        commitFieldElement = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(commitFieldXpath))
        commitFieldElement.click()
开发者ID:samulord,项目名称:microhard_provision,代码行数:27,代码来源:mhcpost.py

示例13: getupc

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import clear [as 别名]
def getupc(data, sleeptime):
    display = Display(visible=0, size=(800, 600))
    display.start()
    a = webdriver.Firefox()
    a.get('https://www.google.com/ncr')
    time.sleep(sleeptime)
    search = WebDriverWait(a, 5).until(EC.element_to_be_clickable((By.XPATH, "//input[@type='text']")))
    for i in data:
        ActionChains(a).move_to_element(search).click(search).send_keys(i['name'] + ' upc', Keys.ENTER).perform()
        time.sleep(sleeptime)
        contents = WebDriverWait(a, 5).until(EC.presence_of_all_elements_located((By.XPATH, "//div[@class='g']")))
        try:
            upc = next(
                    (re.split(r'/', href.find_element_by_tag_name('a').get_attribute('href'))[-1] for
                     href in contents if
                     href.find_element_by_tag_name('a').get_attribute('href').startswith(
                             'http://www.upcitemdb.com/upc')))
            i['upc'] = upc
        except StopIteration:
            pass

        search = WebDriverWait(a, 5).until(EC.element_to_be_clickable((By.XPATH, "//input[@type='text']")))
        search.clear()
    a.close()
    display.stop()
    return data
开发者ID:zheverson,项目名称:videoitem,代码行数:28,代码来源:scrapeinfo.py

示例14: test_Login

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import clear [as 别名]
    def test_Login(self):
        driver = self.driver

        # Facebook web element variables
        emailFieldID     = "email"
        facebookUsername = "***********@gmail.com"
        passFieldID      = "pass"
        facebookPassword = "***********"
        loginButtonXpath = "//input[@value='Log In']"
        fbLogoXpath      = "(//a[contains(@href, 'logo')])[1]"

        # Create elements (allowing 10s to load)
        emailFieldElement = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_id(emailFieldID))
        passFieldElement = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_id(passFieldID))
        loginButtonElement = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(loginButtonXpath))

        # Actions: Log in
        emailFieldElement.clear()
        emailFieldElement.send_keys(facebookUsername)
        passFieldElement.clear()
        passFieldElement.send_keys(facebookPassword)
        loginButtonElement.click()

        # Verify successful login by locating fb logo
        WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(fbLogoXpath))

        # Verify the actions visually
        time.sleep(3)
开发者ID:lukexyz,项目名称:Selenium-Examples,代码行数:30,代码来源:2016-05-11-LDW-Selenium-facebook-login.py

示例15: login

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import clear [as 别名]
	def login(self, browser):
		"""
		利用配置文件和初始化信息进行模拟登陆
		:param:浏览器对象,已打开原始的登录页面
		:return:浏览器对象
		"""
		browser.get( self.config['BussinessStaffURL'] )
		browser.switch_to.frame( browser.find_element_by_tag_name("iframe") )
		userNameInput = browser.find_element_by_name("TPL_username")
		userNameInput.clear()
		userNameInput.send_keys( self.username+Keys.TAB+self.password+Keys.RETURN )
		browser.switch_to.default_content()
		loopKey = True
		while loopKey:
			try:
				WebDriverWait( browser, 4 ).until( EC.presence_of_element_located( ( By.CSS_SELECTOR, "ul>li>a>div>strong>span" ) ) )
				loopKey = False
			except Exception:
				browser.switch_to.frame( browser.find_element_by_tag_name("iframe") )
				passwordInput  = WebDriverWait(browser,10).until( EC.presence_of_element_located( (By.ID, "TPL_password_1") ) )
				passwordInput.clear()
				passwordInput.send_keys( self.password )
				checkCodeInput = WebDriverWait(browser,10).until( EC.presence_of_element_located( (By.ID,"J_CodeInput_i") ) )
				checkCode = enterbox("请输入验证码(不区分大小写)","验证码输入","", True)
				checkCodeInput.send_keys(checkCode+Keys.RETURN)
				browser.switch_to.default_content()
				loopKey = True

		return browser
开发者ID:EndlessCheng,项目名称:webCrawler,代码行数:31,代码来源:BusinessStaff.py


注:本文中的selenium.webdriver.support.ui.WebDriverWait.clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。