本文整理汇总了Python中selenium.webdriver.support.ui.WebDriverWait.replace方法的典型用法代码示例。如果您正苦于以下问题:Python WebDriverWait.replace方法的具体用法?Python WebDriverWait.replace怎么用?Python WebDriverWait.replace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类selenium.webdriver.support.ui.WebDriverWait
的用法示例。
在下文中一共展示了WebDriverWait.replace方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_naGenF
# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import replace [as 别名]
def test_naGenF(self):
driver = self.driver
driver.switch_to_window(driver.window_handles[1])
print "test_naGenF"
all_taxes = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_class_name("tax"))
all_taxes_list = list(tax.text for tax in all_taxes.find_elements_by_tag_name("option"))
print all_taxes_list
global dict_withTaxOnG
dict_withTaxOnG= {}
#-------------------------generowanie faktury----------------------
def generujF():
driver.find_element_by_id("save_elements").click()
driver.find_element_by_name("submit").click()
return
for tax in all_taxes_list:
driver.switch_to_window(driver.window_handles[1])
self.driver.implicitly_wait(3)
taxOnF = Select(driver.find_element_by_name('elements[vat][]')).select_by_visible_text(tax)
generujF()
driver.switch_to_window(driver.window_handles[-1])
with_tax_naGenF= WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(".//*[@id='pageContainer1']/xhtml:div[2]/xhtml:div[47]")).text
dict_withTaxOnG[tax] = float(with_tax_naGenF.replace(",", "."))
print dict_withTaxOnG
print dict_withTax
self.assertEqual(dict_withTax, dict_withTaxOnG)
示例2: test_sprawdzVat
# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import replace [as 别名]
def test_sprawdzVat(self):
driver = self.driver
driver.switch_to_window(driver.window_handles[1])
without_tax = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_class_name("without_tax")).text
without_tax_f = float(without_tax.replace("," , "."))
all_taxes = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_class_name("tax"))
for tax in all_taxes.find_elements_by_tag_name("option"):
print "petla dla: " + tax.text
if tax.text in ("-" , "zw"):
print tax.text
print without_tax_f
with_tax = without_tax_f
else:
tax_f =float(tax.text.replace("," , "."))
print tax_f
with_tax = without_tax_f + (tax_f * without_tax_f)/100
print with_tax
Select(driver.find_element_by_name('elements[vat][]')).select_by_visible_text(tax.text)
# save_elementsBtn = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_id("save_elements"))
# save_elementsBtn.click()
with_tax_naF = float(driver.find_element_by_class_name("with_tax").text.replace(",", "."))
self.assertEqual(with_tax, with_tax_naF)
示例3: test_sprawdzVat
# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import replace [as 别名]
def test_sprawdzVat(self):
driver = self.driver
driver.switch_to_window(driver.window_handles[1])
without_tax = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_class_name("without_tax")).text
without_tax_f = float(without_tax.replace("," , "."))
all_taxes = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_class_name("tax"))
#----------------dict with zip :))) pythonic way:)))) z dala od JAVA!!!!---------------------
all_taxes_list = list(tax.text for tax in all_taxes.find_elements_by_tag_name("option"))
global dict_withTax
dict_withTax = {}
for tax in all_taxes.find_elements_by_tag_name("option"):
print "petla dla: " + tax.text
if tax.text in ("-" , "zw"):
with_tax = without_tax_f
else:
tax_f =float(tax.text.replace("," , "."))
with_tax = without_tax_f + (tax_f * without_tax_f)/100
dict_withTax[tax.text] = with_tax
Select(driver.find_element_by_name('elements[vat][]')).select_by_visible_text(tax.text)
with_tax_naF = float(driver.find_element_by_class_name("with_tax").text.replace(",", "."))
self.assertEqual(with_tax, with_tax_naF)
print dict_withTax
示例4: test_sprawdzVat
# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import replace [as 别名]
def test_sprawdzVat(self):
driver = self.driver
driver.switch_to_window(driver.window_handles[1])
without_tax = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_class_name("without_tax")).text
without_tax_f = float(without_tax.replace("," , "."))
all_taxes = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_class_name("tax"))
for tax in all_taxes.find_elements_by_tag_name("option"):
driver.switch_to_window(driver.window_handles[1])
print "petla dla: " + tax.text
if tax.text in ("-" , "zw"):
print tax.text
print without_tax_f
with_tax = without_tax_f
else:
tax_f =float(tax.text.replace("," , "."))
print tax_f
with_tax = without_tax_f + (tax_f * without_tax_f)/100
print with_tax
Select(driver.find_element_by_name('elements[vat][]')).select_by_visible_text(tax.text)
with_tax_naF = float(driver.find_element_by_class_name("with_tax").text.replace(",", "."))
self.assertEqual(with_tax, with_tax_naF)
#-------------------------generowanie faktury----------------------
driver.find_element_by_id("save_elements").click()
driver.find_element_by_name("submit").click()
driver.switch_to_window(driver.window_handles[2])
with_tax_naGenF= WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(".//*[@id='pageContainer1']/xhtml:div[2]/xhtml:div[47]")).text
self.assertEqual(with_tax, with_tax_naGenF)
print with_tax_naGenF, with_tax