本文整理汇总了Python中selenium.webdriver.support.wait.WebDriverWait.clear方法的典型用法代码示例。如果您正苦于以下问题:Python WebDriverWait.clear方法的具体用法?Python WebDriverWait.clear怎么用?Python WebDriverWait.clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类selenium.webdriver.support.wait.WebDriverWait
的用法示例。
在下文中一共展示了WebDriverWait.clear方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_contact_key_creator
# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import clear [as 别名]
def test_contact_key_creator(self):
self.logger.info('Starting test_contact_key_creator')
#setup the doc on gdrive first
file_name = 'ContactKeyTest1'
ss_key = gdoc_util.upload_file_to_gdrive('contact_key_test1.tsv', file_name)
driver = self.driver
gdoc_util.login_gdrive(driver)
driver.get('%s%s' % (self.base_url, '?ss=' + ss_key))
gc = gspread.login(settings.DEFAULT_GDRIVE_EMAIL, settings.DEFAULT_GDRIVE_PW)
my_worksheet = gc.open_by_key(ss_key).sheet1
e2_val = my_worksheet.acell('E2')
self.logger.info('e2_val: %s' % e2_val)
#reset the cell
my_worksheet.update_acell('E2', '')
e2_val = my_worksheet.acell('E2')
self.logger.info('e2_val reset to: %s' %e2_val)
#now run the command
#switch to input form frame
driver.switch_to.frame(0)
WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.LINK_TEXT, "Hiplead"))
).click()
id_worksheet_name_INPUT = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.ID, "id_worksheet_name"))
)
id_worksheet_name_INPUT.clear()
id_worksheet_name_INPUT.send_keys(file_name)
Select(driver.find_element_by_id("id_scrapers")).select_by_value('contactKeyCreator')
driver.find_element_by_id("id_email").send_keys(settings.DEFAULT_GDRIVE_EMAIL)
driver.find_element_by_id("id_password").send_keys(settings.DEFAULT_GDRIVE_PW)
#ok, now submit the form
id_worksheet_name_INPUT.submit()
#then wait for task to complete
#this success alert only becomes visible when task is actually finished.
success_div = driver.find_element_by_class_name('time_remaining')
try:
WebDriverWait(driver, 10).until(
EC.visibility_of(success_div)
)
except StaleElementReferenceException as e:
#TODO The javascript DOM manipulation that results in StaleElementReferenceException needs to be resolved.
success_div = driver.find_element_by_class_name('time_remaining')
WebDriverWait(driver, 10).until(
EC.visibility_of(success_div)
)
#now validate cell value, since we know task has completed.
e2_val = my_worksheet.acell('E2')
self.logger.info('e2_val after test: %s' %e2_val)
self.assertEquals('john_franklin_smith_somedomain.net', e2_val.value)
self.logger.info( 'Finished test_contact_key_creator')
示例2: set_code
# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import clear [as 别名]
def set_code(code):
try:
driver.switch_to_frame('main')
except:
pass
'''
try:
driver.find_element_by_link_text('QUOTES').click()
except:
pass
'''
inbox = WebDriverWait(driver,10).until(lambda driver :
driver.find_element_by_id('secCode'))
inbox.clear()
inbox.send_keys(code)
driver.find_element_by_id('btnGoSI').click()
示例3: Change_Amound_Component
# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import clear [as 别名]
def Change_Amound_Component(self, amound):
panel = self.Define_Panel_button()
button = WebDriverWait(panel, 2).until(
EC.element_to_be_clickable((By.XPATH, "./button[4]"))
)
button.click()
panel = self.Define_Panel_button()
input = WebDriverWait(panel, 2).until(
EC.presence_of_element_located((By.XPATH, "./input"))
)
input.clear()
input.send_keys(amound)
panel = self.Define_Panel_after_change()
button = WebDriverWait(panel, 3).until(
EC.presence_of_element_located((By.XPATH, "./button[2]"))
)
button.click()
示例4: test_site
# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import clear [as 别名]
def test_site(self):
driver = self.driver
driver.get(self.my_url)
#Input account information
signin_link = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.LINK_TEXT, "Sign In"))
)
signin_link.click()
#Email
signin_email = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.ID, "signin-email"))
)
signin_email.clear()
signin_email.send_keys("[email protected]")
#Password
signin_password = driver.find_element_by_id("signin-password")
signin_password.clear()
signin_password.send_keys("******")
driver.find_element_by_class_name("coursera-signin-button").click()
#Check login
user_name = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.CSS_SELECTOR, "span.coursera-header-account-name"))
)
self.assertEqual(" Aleksey", user_name.text)
示例5: set_campaign_name
# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import clear [as 别名]
def set_campaign_name(self, name):
edit_box = WebDriverWait(self.driver, WebDriverSettings.WEBDRIVER_TIMEOUT, WebDriverSettings.WEBDRIVER_POLL_FREQUENCY).until(
lambda d: d.find_element_by_css_selector(self.CAMPAIGN_NAME)
)
edit_box.clear()
edit_box.send_keys(name)
示例6: set_banner_text
# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import clear [as 别名]
def set_banner_text(self, text):
element = WebDriverWait(self.driver, 30, 3).until(
lambda el: el.find_element_by_css_selector(self.BANNER_TEXT_AREA)
)
element.clear()
element.send_keys(text)
示例7: set_banner_title
# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import clear [as 别名]
def set_banner_title(self, title):
element = WebDriverWait(self.driver, 30, 3).until(
lambda el: el.find_element_by_css_selector(self.BANNER_TITLE)
)
element.clear()
element.send_keys(title)
示例8: set_campaign_name
# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import clear [as 别名]
def set_campaign_name(self, name):
element = WebDriverWait(self.driver, 30, 3).until(
lambda el: el.find_element_by_css_selector(self.CAMPAIGN_NAME)
)
element.clear()
element.send_keys(name)